Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
cs-142:checking-cin-fail [2016/09/14 08:59]
kseppi
cs-142:checking-cin-fail [2016/09/14 18:43]
kseppi
Line 53: Line 53:
  cout << endl;  cout << endl;
  cout << "So code to check for and recover from errors looks like:" << endl;  cout << "So code to check for and recover from errors looks like:" << endl;
- cout << "​Number please: (be nice or cause an error, I can deal with it!) " ​<< endl;+ cout << "​Number please: (be nice or cause an error, I can deal with it!) ";
  cin >> number;  cin >> number;
  cout << endl;  cout << endl;
Line 80: Line 80:
  string line;  string line;
  getline(cin,​ line);  getline(cin,​ line);
 + cout << endl;
  cout << "Here is the line: " << line << endl;  cout << "Here is the line: " << line << endl;
  cout << endl;  cout << endl;
- cout << "Not what you expected? cin grabed ​only the number leaving the endl waiting to be processed."​ << endl;+ cout << "Not what you expected? cin grabbed ​only the number leaving the endl waiting to be processed."​ << endl;
  cout << "​Usually I do these two steps together 1) the cin..."​ << endl;  cout << "​Usually I do these two steps together 1) the cin..."​ << endl;
  cout << "​Number please:"​ << endl;  cout << "​Number please:"​ << endl;
cs-142/checking-cin-fail.txt ยท Last modified: 2016/09/14 18:43 by kseppi
Back to top
CC Attribution-Share Alike 4.0 International
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0