For computer class im trying to make a yazee game. Im trying to make it so that when you get more than one of the same number, it will put those off to the side for you, and make new numbers with the remaining slots. So far here is what i haveim pretty new to this stuff)
Code:
#include<iostream>
#include<time.h>
using std::cout;
using std::cin;
using std::endl;
void main()
{
int dice1, dice2, dice3, dice4, dice5, choice;
srand(time(0));
cout<<" ----- \n";
cout<<"|Yazee|\n";
cout<<" ----- \n";
cout<<"Enter 1 to roll, or 2 to quit.\n";
cin>>choice;
if(choice==2)
{
cout<<"Thanks for playing.\n";
}
if(choice==1)
{
dice1=1+rand()%6;
dice2=1+rand()%6;
dice3=1+rand()%6;
dice4=1+rand()%6;
dice5=1+rand()%6;
cout<<"Rolling dice...\n";
cout<<" -------------------\n";
cout<<"|["<<dice1<<"]-["<<dice2<<"]-["<<dice3<<"]-["<<dice4<<"]-["<<dice5<<"]|\n";
cout<<" -------------------\n";
}
if(dice1==dice2==dice3==dice4==dice5){
cout<<"YAZEE!!! YOU WIN!\n";
}
}
Now if i did anything wrong let me know, but it seems to generate the numbers just fine.
Is there an easy way to make it so it keeps numbers that are the same, and goes on to random the remaining dice over again? I can see a long way... a looooong way, but the people in my class dont know much so im trying to keep it simple. Any ideas or tips are helpful, thanks. If not i'll have to think up another game.
[code][/code]tagged by Salem