Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <conio.h>
- #include <time.h>
- #include <algorithm>
- #include <math.h>
- using namespace std;
- int main(int argc, char *argv[])
- {
- // 1
- int s,s2;
- s = 0;
- s2 = 0;
- srand(time(NULL));
- int *wi;
- wi = new int;
- wi = new int[10];
- for (int i=0;i<10;i++){
- wi[i] = rand()%10;
- s += wi[i];}
- cout << endl;
- for (int i=9;i>=0;i--)
- cout << wi[i] << " ";
- cout << endl;
- // 2
- int *wi2;
- wi2 = new int;
- wi2 = new int[10];
- for (int i=0;i<10;i++){
- wi[i] = rand()%10;
- s2 += wi[i];}
- cout << endl;
- for (int i=9;i>=0;i--)
- cout << wi[i] << " ";
- cout << endl;
- if (*wi == *wi2)
- cout << " takie same";
- else
- cout << "rozne";
- cout << endl;
- //suma
- cout << s << endl;
- cout << s2 << endl;
- //sort
- sort(wi, wi + 10);
- for (int i=0;i<0;i++)
- cout << wi[i] << " ";
- cout << endl;
- sort(wi2, wi2 + 10);
- for (int i=0;i<0;i++)
- cout << wi2[i] << " ";
- cout << endl;
- //min
- int min = wi[0];
- for(int i=1;i<10;i++)
- if(min>wi[i])
- min = wi[i];
- cout << min << endl;
- // max
- int max = wi[0];
- for(int i=1;i<10;i++)
- if(max<wi[i])
- max = wi[i];
- cout << max << endl;
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement