Advertisement
irmantas_radavicius

Untitled

Feb 20th, 2024
803
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <sstream>
  4. #include <cctype>
  5. #include <vector>
  6.  
  7.  
  8.  
  9. using namespace std;
  10.  
  11. int main(){
  12.  
  13.     /*
  14.     int x;
  15.     while(1){
  16.         cout << "Iveskite skaiciu: ";
  17.         cin >> x;
  18.         char c = cin.get();
  19.         if(cin.fail() || (c != '\n')){
  20.             cout << "Blogas ivedimas!" << endl;
  21.             cin.clear();
  22.             cin.ignore(1024, '\n');
  23.  
  24.         } else
  25.             break;
  26.     }
  27.     // x yra geras
  28.     cout << "Tu ivedei " << x << endl;
  29.     */
  30.  
  31.     /*
  32.     double x;
  33.     int y;
  34.     while(1){
  35.         cout << "Iveskite du skaicius (double ir int): ";
  36.         cin >> x;
  37.         cin >> y;
  38.         char c = cin.get();
  39.         if(cin.fail() || (c != '\n')){
  40.             cout << "Blogas ivedimas!" << endl;
  41.             cin.clear();
  42.             cin.ignore(1024, '\n');
  43.  
  44.         } else
  45.             break;
  46.     }
  47.     // x ir y yra geri
  48.     cout << "Tu ivedei " << x << " ir " << y << endl;
  49.     */
  50.  
  51.     /*
  52.     vector<int> v;
  53.     while(1){
  54.         string line;
  55.         cout << "Ivesk skaiciu sarasa: ";
  56.         getline(cin, line);
  57.  
  58.         stringstream ss;
  59.         ss << line;
  60.         int klaida = 0;
  61.         while(1){
  62.             int x;
  63.             ss >> x;
  64.             if(!ss.fail()){
  65.                 v.push_back(x);
  66.             } else {
  67.                 if(!ss.eof())
  68.                     klaida = 1;
  69.                 break;
  70.             }
  71.         }
  72.         if(klaida == 0) // && v.size() % 2 == 1)
  73.             break;
  74.         else {
  75.             cout << "Blogas ivedimas" << endl;
  76.             v.clear();
  77.         }
  78.     }
  79.     // skaiciu sarasas yra geras
  80.     for(int i = 0; i < v.size(); i++)
  81.         cout << v[i] << " ";
  82.     cout << endl;
  83.     */
  84.     return 0;
  85.  
  86. }
  87.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement