Code
#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;
int liczba,licz,n, proba=0;
int liczba_losowa(float l);
int main()
{
{
cout << "losuje pierwsza liczbe z zakresu 0...10" << endl;
srand(time(NULL));
liczba=rand()%11;
cout << liczba <<endl;
cout << "losuje druga liczbe z zakresu 0...10" << endl;
licz=rand()%11;
cout << licz <<endl;
while(liczba!=licz)
{
proba++;
if (licz==liczba)
cout <<"koniec, probowalem "<<proba<<" razy" << endl;
else if (licz>liczba)
cout << "probuje ponownie"<< endl;
else if (licz<liczba)
cout <<"probuje ponownie" << endl;
}
}
return 0;
}
what to put into while() ?? some kind of another function 'n' thats licz-liczba=0?
Like that it is atm it shows endless message of "trying again"
This post was edited by Devusss on Jan 7 2015 05:58pm