getline
From: slurper (slurper1234_at_hotmail.com)
Date: 04/14/04
- Next message: osmium: "Re: automatic source code"
- Previous message: Ioannis Vranos: "Re: How to initialize a char*?"
- Next in thread: Rob Williscroft: "Re: getline"
- Reply: Rob Williscroft: "Re: getline"
- Reply: John Harrison: "Re: getline"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 14 Apr 2004 15:38:24 +0200
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
- Next message: osmium: "Re: automatic source code"
- Previous message: Ioannis Vranos: "Re: How to initialize a char*?"
- Next in thread: Rob Williscroft: "Re: getline"
- Reply: Rob Williscroft: "Re: getline"
- Reply: John Harrison: "Re: getline"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|