S
slurper
what's wrong with this program:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string string1, string2;
cout << "Type a word: ";
cin >> string1;
cout << "You typed: " << string1 << endl;
cout << "now type a line: ";
getline( cin, string2 ); <-------- doesn't wait for me here
cout << "you typed: " << string2 << endl;
return 0;
}
it compiles but when run it doesn't wait for me to enter a sentence at the
getline command
output:
Type a word: lol
You typed: lol
now type a line: you typed:
platform: mandrake linux using g++ on i386
#include <iostream>
#include <string>
using namespace std;
int main()
{
string string1, string2;
cout << "Type a word: ";
cin >> string1;
cout << "You typed: " << string1 << endl;
cout << "now type a line: ";
getline( cin, string2 ); <-------- doesn't wait for me here
cout << "you typed: " << string2 << endl;
return 0;
}
it compiles but when run it doesn't wait for me to enter a sentence at the
getline command
output:
Type a word: lol
You typed: lol
now type a line: you typed:
platform: mandrake linux using g++ on i386