Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- main()
- {
- int N=5;
- int p;
- int t[N];
- for(int i=0; i<N; i++)
- {
- cout << "wprowadz liczbe nr " << i+1 << ":" << endl;
- cin >> t[i];
- }
- for(int i=0; i<N; i++)
- {
- cout << t[i] << " ";
- }
- cout << "sortujemy: " << endl;
- for(int i=0; i<N-1; i++)
- {
- if( t[i+1] > t[i] )
- {
- p = t[i];
- t[i] = t[i+1];
- t[i+1]=p;
- }
- }
- cout << endl;
- for(int i=0; i<N; i++)
- {
- cout << t[i] << " ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement