Guest User

Untitled

a guest
Oct 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. 1 2 3
  2. 2 1
  3. 3 1
  4.  
  5. int getNumber(ifstream &input, string &inputStr, char &nextChar) {
  6.  
  7. inputStr.clear();
  8.  
  9. // Append digits to the string until either a space or newline is encountered.
  10. while(nextChar != ' ' && nextChar != 'n')
  11. {
  12. inputStr.append(1, nextChar);
  13.  
  14. input.get(nextChar);
  15. }
  16.  
  17. int number = stoi(inputStr);
  18.  
  19. return number;
Add Comment
Please, Sign In to add comment