Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- #include <cstdlib>
- #include <ctime>
- #include <conio.h>
- using namespace std;
- int main()
- {
- srand(time(NULL));
- int tab[10];
- int x=0;
- int a,b=0;
- int j;
- cout<<"Poczatek"<<endl;
- cin>>a;
- cout<<"koniec"<<endl;
- cin>>b;
- for (int i=0; i<9; i++)
- {
- int f=0;
- do
- {
- x=a+int((b-a+1)*rand()/(RAND_MAX+1.0));
- for (j=0; j<9; j++);
- {
- if(tab[j]==x)
- {
- f=1;
- }
- if (tab[j]!=x)
- {
- f=0;
- }
- }
- } while(f==1);
- tab[i]=x;
- cout<<tab[i]<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement