Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main()
- {
- for(;;){
- int liczbalos;
- srand(time(0));
- liczbalos = rand() %100 +1;
- int zgadl;
- cout<<"Witamy w zgaduj zgadula, system wylosowal jedna liczbe z zakresu 1-100, sprobuj zgadnac ktora to!"<<endl;
- do{
- cin>>zgadl;
- if(cin){
- if(liczbalos>zgadl){
- cout<<"Za malo!"<<endl;
- }else if(liczbalos<zgadl){
- cout<<"Za duzo!"<<endl;
- }else{
- cout<<"Brawo! Zgadles!"<<endl;
- }
- }else {cout<<"Bledna liczba!"<<endl; cin.clear(); cin.sync(); }
- }while(zgadl!=liczbalos);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement