gghorseman
Programmer
The following code demonstrates a problem I am having with getline(stream,var) in a Console app. The code should let you enter a string and when you press <ENter> , display it. In two different Unix systems it works as it should. In Visuall C++ ver 6.0, you have to press <Enter> TWICE before the input is selected and the string displayed. Anyone know why??
#include <iostream>
#include <string>
using namespace std;
int main(){
string Something(""
cout << "Enter Something: ";
getline(cin,Something);
cout << Something << "|" << endl;
return 1;
}
#include <iostream>
#include <string>
using namespace std;
int main(){
string Something(""
cout << "Enter Something: ";
getline(cin,Something);
cout << Something << "|" << endl;
return 1;
}