Search found 4 matches
- Fri Jul 06, 2007 6:39 pm
- Forum: C++
- Topic: How to check for blank line?
- Replies: 5
- Views: 4983
- Fri Jul 06, 2007 4:31 pm
- Forum: C++
- Topic: How to check for blank line?
- Replies: 5
- Views: 4983
- Fri Jul 06, 2007 4:23 am
- Forum: C++
- Topic: How to check for blank line?
- Replies: 5
- Views: 4983
How to check for blank line?
I'm having trouble figuring out how to read in numbers until I hit a blank line. This is what I have so far, and I've looked into getline and cin and others.
bool keep_going = true;
string z;
int a;
while(keep_going){ //stay in while loop until blank line
getline(cin, z); //read in line
a = z ...
bool keep_going = true;
string z;
int a;
while(keep_going){ //stay in while loop until blank line
getline(cin, z); //read in line
a = z ...
- Thu Jul 05, 2007 5:46 pm
- Forum: C++
- Topic: Reading a blank line in c++
- Replies: 1
- Views: 2359
Reading a blank line in c++
I'm trying to read a blank line for the problem 10033 Interpreter (I've searched and didn't find anything too helpful).
The code i have right now is a simple whle loop like this:
cin >> j;
while(j != '\n'){
//<code>
cin>>j;
}//end while
but it doesn't seem to work.
I'm a recent convert from ...
The code i have right now is a simple whle loop like this:
cin >> j;
while(j != '\n'){
//<code>
cin>>j;
}//end while
but it doesn't seem to work.
I'm a recent convert from ...