#include
#include
void yourturn(int&total){
int request;
do{
cout<<"There are "<
cin>>request;
if((request<3||request>1)||(request
cout<<"Value must be between 1 and 3"<
cout<<"How many would you like?"<
cin>>request;
}
}while((request<3||request>1)||(request
total-=request;
return;
}
void myturn(int&total){
randomize();
int myrequest;
if (total>4){
cout<<"There are "<
myrequest=random (3)+1;
cout<
}
if (total==4){
cout<<"There are "<
myrequest=3;
cout<
}
total-=myrequest;
return;
}
int main(){
randomize();
int total=random(30)+15;
while(char answer='Y'){
yourturn(total);
if(total==1){
cout<<"THE COMPUTER WINS YOU NOOB";
}
myturn(total);
if(total=1){
cout<<"Ok...you beat the computer, woopdidoo";
2006-11-30
12:09:01
·
1 answers
·
asked by
Anonymous
in
Computers & Internet
➔ Programming & Design
}
}
cout<<"Play again (Y) or (N)";
return 0;
}
2006-11-30
12:09:22 ·
update #1