Check out the Pastebin Gadgets Shop. We have thousands of fun, geeky & affordable gadgets on sale :-)Want more features on Pastebin? Sign Up, it's FREE!
tweet

# Untitled

By: a guest on Mar 15th, 2012  |  syntax: C++  |  size: 1.12 KB  |  views: 23  |  expires: Never
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
1. int a, b;
2.
3.         cout << "Podaj 2 liczby" << endl;
4.         cin >> a >> b;
5.         cout << "Zmienne przed zamiana: a = " << a << ", b = " << b << endl;
6.         a=a+b;
7.         b=a-b;
8.     a=a-b;
9.         cout << "Zmienne po zamianie: a = " << a << ", b = " << b << endl;*/
10.
11.         /*
12.         int tab[3];
13.         int a, b, c;
14.         bool f = false;
15.
16.         cout << "Podaj 3 liczby " << endl;
17.         cin >> a >> b >> c;
18.
19.         if (a < b && b < c) { tab[0] = c; tab[1] = b; tab[2] = a;}
20.         else if (c < b && b < a) { tab[0] = a; tab[1] = b; tab[2] = c;}
21.         else if (b < a && a < c) { tab[0] = c; tab[1] = a; tab[2] = b;}
22.         else if (c < a && a < b) { tab[0] = b; tab[1] = a; tab[2] = c;}
23.         else if (b < c && c < a) { tab[0] = a; tab[1] = c; tab[2] = b;}
24.         else if (a < c && c < b) { tab[0] = b; tab[1] = c; tab[2] = a;}
25.
26.         cout << "Posortowane: " <<tab[0] <<endl << tab[1] << endl << tab[2] << endl ;
27.
28.         while (!f)
29.         {
30.                 cout <<"Podaj liczbe: " << endl;
31.                 cin >> a;
32.
33.                 if (a == 0)
34.                         f = true;
35.                 else
36.                 {
37.                         if (a > tab[0]) tab[0] = a;
38.                         else if (a > tab[1]) tab[1] = a;
39.                         else if (a > tab[2]) tab[2] = a;
40.                 }
41.         }
42.         cout << "Posortowane: " <<tab[0] <<endl << tab[1] << endl << tab[2] << endl ;
clone this paste RAW Paste Data
Top