Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#include<iostream>

#include<cstdlib>
#include<ctime>
using namespace std;
void boardPrint(){
for(int r=1;r<=30;r++){
for(int c=1;c<=30;c++){

if( r==1 ||r==10 || r==16 ||r==20 ||r==30 || c==1 ||((r>1 &&


r<=16)&&(c==17))||c==10 || c==30){
cout<<"*";

}
// if( r==2 && c== 2 )
// cout<<"A";
else
cout<<" ";
}
cout<<endl;
}

}
int rollDice(){

return rand()%6+1;
}
int numOfPlayers(){
int numofplayers;
cout<<"Enter the number of players "<<endl;

cin>>numofplayers;
while(numofplayers>4 || numofplayers<=1 ){
cout<<"Enter number of players with in range of 2 to 4 "<<endl;
cin>>numofplayers;
}
return numofplayers;
}
void rollDiceForPlayers(int players){
for(int i=1;i<=players;i++){
cout<<"Dice number for player "<<i<<" is "<<rand()%6+1<<endl;

}
}
int main(){

srand(time(0));

boardPrint();
int numofplayers=numOfPlayers();
rollDiceForPlayers(numofplayers);

You might also like