Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <cstdlib> //funkcja rand
- #include <time.h>
- using namespace std;
- int liczba, strzelaj;
- int main()
- {
- cout<<"Witamy w losowaniu! Wybierz sobie liczbe w przedziale 1..100:"<<endl;
- cout<<"Podaj liczbe z tego przedzialu: "<<endl;
- cin>>strzelaj;
- srand(time(NULL)); //start randomaizing, zacznij generowac liczy losowe
- liczba= rand()% 100+1;
- /* funkcja rand() oznacza przedzial dla 100 sa to liczby 0-99, wiec*/ // musimy dodac 1,
- while(strzelaj!=liczba)
- {
- if(strzelaj>liczba)
- {
- cout<<"TWOJA liczba jest za duza "<<endl;
- }
- else if(strzelaj == liczba)
- {
- cout<<"Wygrales, liczba podana przez Ciebie jest prawidlowa"<<endl;
- }
- else if(strzelaj < liczba)
- {
- cout<<"Twoja liczba jest za mala. "<<endl;
- }
- }
- cout<<"wypiszesz to gnoju"<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement