Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 12th, 2012  |  syntax: None  |  size: 0.24 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How can I clear the input stream in c  ?
  2. cout << "A:";
  3. cin >> string_var;
  4. cout << "B";
  5. cin >> string_var2;
  6.        
  7. cout << "A: ";
  8. cin >> string_var;
  9. // clear remaining stream input
  10. while(cin.get() != 'n');
  11.  
  12. cout << "B: ";
  13. cin >> string_var2;