Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- void zad_1();
- void zad_2();
- void zad_3();
- void zad_4();
- void zad_5();
- int main()
- {
- srand(time(NULL));
- cout<<"Zadanie 1"<<endl;
- zad_1();
- cout<<endl;
- cout<<"Zadanie 2"<<endl;
- zad_2();
- cout<<endl;
- cout<<"Zadanie 3"<<endl;
- zad_3();
- cout<<endl;
- cout<<"Zadanie 4"<<endl;
- zad_4();
- cout<<endl;
- cout<<"Zadanie 5"<<endl;
- zad_5();
- cout<<endl;
- return 0;
- }
- void zad_1(){
- for(int i=0; i<3; i++) cout<<rand()%10<<endl;
- }
- void zad_2(){
- for(int i=0; i<5; i++) cout<<30+rand()%(11)<<endl;
- }
- void zad_3(){
- int sum = 0;
- for(int i=0; i<100; i++) sum += 10+rand()%(11);
- cout<<sum<<endl;
- }
- void zad_4(){
- for(int i=0; i<10; i++) cout<<rand()%2<<endl;
- //zdaje sie ze sa losowe (0 [reszka] oraz 1 [orzel])
- }
- void zad_5(){
- int ran;
- do{
- ran = -1000 + rand()%2001;
- cout<<ran<<endl;
- }while(!((ran >= 100) && (ran <= 200)));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement