G2A Many GEOs
SHARE
TWEET

Number in string atoi

JOHNYTHEWINNER Feb 8th, 2020 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # include <iostream>
  2. using namespace std;
  3. #include <iomanip>
  4. #include <math.h>
  5. #include <cmath>
  6. #include <string>
  7. int main()
  8. {
  9.     string temp;
  10.     cin >> temp;
  11.     int sum = 0;
  12.     do {
  13.         int num = atoi(temp.c_str());
  14.         sum += num;
  15.         cin >> temp;
  16.     } while (temp != "Stop");
  17.     cout << sum << endl;
  18.  
  19.     return 0;
  20. }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top