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