#include<iostream>
#include<conio.h>
#include<ctime>
using namespace std;
int Rolldie();
//char Validateinput(char answer, char opt1, char opt2);
int main()
{
int score=0;
int dice_number[13]={0};
int number=0;
int i=0;
int d=0;
char answer;
char bar;
cout<<"How many times do you want to roll the dice? ";
cin>>number;
cout<<endl;
cout<< "Please enter I for Individual and F for final to see the scores."<<endl;
cout<<"Do you want to see the Final score or the Individual scores? ";
cin>>answer;
srand(clock());
for(i=0;i<=number;i++)
{
int die1=Rolldie();
int die2=Rolldie();
score = die1 + die2;
//first loop
if(answer=='i' || answer=='I')
{
cout<<die1<<"+"<<die2<<"=";
cout<<score<<endl;
}
if(answer=='f' || answer=='F')
{
cout<<"The final score is: "<< <<endl;
}
}
getch();
return 0;
}
int Rolldie()
{
return rand()%6+1;
}
This post has been edited by no2pencil: 09 November 2010 - 11:39 PM
Reason for edit:: Corrected code tags

New Topic/Question
Reply



MultiQuote


|