Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <time.h>
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- int liczba_pocz, liczba_konc, przedzial, wynik;
- int main()
- {
- cout<<"Podaj przedział liczb całkowitych do losowania"<<endl<<"Liczba początkowa: ";
- srand(time(NULL));
- cin>>liczba_pocz;
- cout<<endl<<"Liczba koncowa: ";
- cin>>liczba_konc;
- przedzial = liczba_konc - liczba_pocz + 1;
- wynik = rand()%przedzial + liczba_pocz;
- cout<<endl<<"Wylosowana liczba: "<<wynik;
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement