Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <cstdlib>
- #include <sstream> // std::stringstream
- using namespace std;
- int main() {
- //string inputString = "The code is getting better code.";
- int k =0;
- cin >> k;
- cin.ignore();
- string input;
- string word;
- int sum =0;
- for(int i =0 ; i<k; i++)
- {
- getline(cin, input);
- // cin.ignore();
- stringstream stream(input);
- while(stream >> word!=0) {
- int number = atoi(word.c_str());
- sum += number;
- }
- }
- cout << sum;
- }
Add Comment
Please, Sign In to add comment