Hello all-
I need to take the first few lines on standard input and print it out. However, I need to check them against some conditions. I have stored the first line in a string vector and then converted to a string stream in preparation for the second line. The following fails:
This fails. Some help would be appreciated.Code:n.clear(); while(getline(cin,n)) { v.push_back(n); if(v[0] != "P2"){ exit(1); //Works up to this point } stringstream ss(n); ss >> a; iv.push_back(n); if(a < 0) exit(1); }



LinkBack URL
About LinkBacks


