Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <string.h>
- #include <vector>
- #include <sstream>
- using namespace std;
- long sstoi(const char *s) // custom stoi function
- {
- long i;
- i = 0;
- while(*s >= '0' && *s <= '9')
- {
- i = i * 10 + (*s - '0');
- s++;
- }
- return i;
- }
- int main()
- {
- string newString, input;
- vector <int> nums(1);
- vector <int> nums2(1);
- vector <int> nums3(1);
- int k =0;
- while(cin>>k)
- {
- cin.ignore();
- getline(cin, input);
- stringstream stream;
- stream.str(input);
- stream.clear();
- while(stream >> newString)
- {
- nums.push_back(sstoi(newString.c_str()));
- }
- getline(cin, input);
- stream.str(input);
- stream.clear();
- while(stream >> newString)
- {
- nums2.push_back(sstoi(newString.c_str()));
- }
- getline(cin, input);
- stream.str(input);
- stream.clear();
- while(stream >> newString)
- {
- nums3.push_back(sstoi(newString.c_str()));
- }
- for(int i =1; i< nums.size(); i++)
- {
- cout << "nums 1 " << nums[i] << endl;
- }
- for(int i =1; i< nums2.size(); i++)
- {
- cout <<"nums 2 " << nums2[i] << endl;
- }
- for(int i =1; i< nums3.size(); i++)
- {
- cout <<"nums 3 " << nums3[i] << endl;
- }
- cout << "K e: " << k << endl;
- }
- }
Add Comment
Please, Sign In to add comment