Advertisement
wikypoo

Untitled

Feb 8th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. if (line.at(i) == 's' && line.at(i + 1) == 'p') {
  2. if (isdigit(line.at(i - 3))) {
  3.  
  4. int value;
  5. // line.at(i-3) and line.at(i-2) are two different numbers. I put them together by multiplying first by ten, then adding // the other one, but it gives me some random numbers
  6.  
  7. value = ((line.at(i-3)) * 10 + line.at(i-2));
  8. cout << value;
  9.  
  10. // this simply prints out the two numbers together. the print out here is correct.
  11. cout << line.at(i - 3) << line.at(i - 2) << endl;
  12.  
  13.  
  14.  
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement