Advertisement
madidino

sesiunea speciala (sub 3_3)

Nov 12th, 2023 (edited)
632
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int main()
  6. {int x;
  7. int mn=1e9;
  8. int mx=-1e9;
  9. int p=0;
  10. int k=0;
  11.     ifstream fin("bac.txt");
  12.     while(fin>>x)
  13.     {p++;
  14.  
  15.         if(x>mx || x<mn)
  16.         {
  17.             if(x>mx)
  18.             {
  19.                 mx=x;
  20.             }
  21.             if(x<mn)
  22.             {
  23.                 mn=x;
  24.             }
  25.         }
  26.         else
  27.         {
  28.             if(mx!=x)
  29.             {
  30.                 k++;
  31.                 cout<<p<<" ";
  32.             }
  33.         }
  34.     }
  35.     if(!k)
  36.     {
  37.         cout<<"nu exista!";
  38.     }
  39.     fin.close();
  40.     return 0;
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement