Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

getline cpp

//getline allows for multi word input including spaces ex. "Jim Barens"
#include <iostream>
#include <string>

int main() 
{
  string namePerson{};     // creating string
  getline(cin, namePerson);// using getline for user input
  std::cout << namePerson; // output string namePerson
}
 
PREVIOUS NEXT
Tagged: #getline #cpp
ADD COMMENT
Topic
Name
4+5 =