Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <sstream>
- #include <cctype>
- #include <vector>
- using namespace std;
- int main(){
- /*
- int x;
- while(1){
- cout << "Iveskite skaiciu: ";
- cin >> x;
- char c = cin.get();
- if(cin.fail() || (c != '\n')){
- cout << "Blogas ivedimas!" << endl;
- cin.clear();
- cin.ignore(1024, '\n');
- } else
- break;
- }
- // x yra geras
- cout << "Tu ivedei " << x << endl;
- */
- /*
- double x;
- int y;
- while(1){
- cout << "Iveskite du skaicius (double ir int): ";
- cin >> x;
- cin >> y;
- char c = cin.get();
- if(cin.fail() || (c != '\n')){
- cout << "Blogas ivedimas!" << endl;
- cin.clear();
- cin.ignore(1024, '\n');
- } else
- break;
- }
- // x ir y yra geri
- cout << "Tu ivedei " << x << " ir " << y << endl;
- */
- /*
- vector<int> v;
- while(1){
- string line;
- cout << "Ivesk skaiciu sarasa: ";
- getline(cin, line);
- stringstream ss;
- ss << line;
- int klaida = 0;
- while(1){
- int x;
- ss >> x;
- if(!ss.fail()){
- v.push_back(x);
- } else {
- if(!ss.eof())
- klaida = 1;
- break;
- }
- }
- if(klaida == 0) // && v.size() % 2 == 1)
- break;
- else {
- cout << "Blogas ivedimas" << endl;
- v.clear();
- }
- }
- // skaiciu sarasas yra geras
- for(int i = 0; i < v.size(); i++)
- cout << v[i] << " ";
- cout << endl;
- */
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement