Hi all
I struggle to capture the space when it is entered as part of the name
The 2 lines commented out is how I try to capture the space but it doesn't work. Anyone mind telling me what i do wrong please?
Here is my code
#include<iostream>
#include<string>
using namespace std;
void displayData( string name, int ID, int StartTime, int EndTime)
{
cout << " Please enter name, ID, Starttime and EndTime " << endl;
//cin.get();
//getline(cin, name, 30);
cin >> ID >> StartTime >> EndTime;
Thanks for the explaination. I see if i change teh statement to getline(cin, name, '\n'); it also works so I will leave it like that ie. without the std::
Correct. I see the actuall issue was that i tried to enter a name like Mr. J. Blog which contained spaces and a period so i had to add '\n'. That was the issue why the problem would'nt run