My program is supposed to end when both a and b are 1.
Please tell me where it is wrong.
Code:
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int roll()
{
return rand()%6+1;
}
int main()
{
srand(time(NULL));
int a,b;
a=roll();b=roll();int count=1;
bool snakeyes=(a==1&&b==1);
while(!snakeyes)
{
cout<<"values of dice are : "<<a<<" and "<<b<<endl;
a=roll();b=roll();
++count;
}
cout<<"values of dice are : "<<a<<" and "<<b<<" , which means snake eyes!\n";
cout<<"it took "<<count<<" rolls.\n";
return 0;
}