Advertisement
catalyn

o9.10.2014

Oct 9th, 2014
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. // fol subprogramel pt fiecare pereche realizati interschimbare intrre elemente
  2. //a b
  3. // c d
  4. //e f
  5. //2) aceleasi perechi cititre din fisier calculati ma si afisati-o pe cea mai mare
  6. #include <iostream>
  7. # include <fstream>
  8. using namespace std;
  9. int schimb(int a,int b)
  10. {
  11. int aux;
  12.  
  13. aux=b;
  14. b=a;
  15. a=aux;
  16. }
  17. int main()
  18. {
  19. int a,b,n,i;
  20. cout<<"n=";cin>>n;
  21. for(i=1;i<=n;i++)
  22. {cout<<"a=";cin>>a;
  23. cout<<"b=";cin>>b;
  24. cout<<schimb(a,b);
  25. cout<<" ";
  26.  
  27. cout<<schimb(b,a);}
  28. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement