Advertisement
alexon5519

4-simulare info 2018

May 11th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7. ifstream f1("atestat.in");
  8. int x,y,aux,a,x1=0,y1=0;
  9. f1>>x>>y;
  10. if(x > y ){
  11. aux=x;
  12. x=y;
  13. y=aux;
  14. }
  15. while(f1>>a){
  16. if(x1 == 0){
  17. if(x < a){
  18. cout<<x<<" ";
  19. x1=1;
  20.  
  21. }
  22. }
  23. if(y1 == 0){
  24. if(y < a){
  25. cout<<y<<" ";
  26. y1=1;
  27.  
  28. }
  29. }
  30. cout<<a<<" ";
  31.  
  32. }
  33. cout<<y;
  34.  
  35.  
  36. f1.close();
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement