Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int a,b,c,d,w;
- int main()
- {
- int tab[10];
- c=50;
- for(int i=0;i<10;i++)
- { tab[i]=1+rand()%(50-2);
- cout << tab[i]<<endl;
- if(tab[i]<c)
- { c=tab[i];
- d=i;}
- if(tab[i]>a)
- { a=tab[i];
- b=i;}}
- cout << "najmniejszy: tab["<<d+1<<"] wynosi: "<<tab[d]<<endl;
- cout << "najwiekszy: tab["<<b+1<<"] wynosi: "<<tab[b];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement