Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

any suggestions will be appreciated Program the Yankee Grah game. The user will

ID: 3629424 • Letter: A

Question

any suggestions will be appreciated

Program the Yankee Grah game. The user will play against the computer Game Rules: Each player takes 3 turns to roll the dice. In the first turn, the player rolls 3 dice and saves the highest scoring die In the second turn, the player the player rolls the 2 remaining dice, and saves the highest scoring die In the third turn, the player rolls the remaining die and saves that score In the event that two dice have the same value, still only 1 die gets saved from each turn The player' score is the sum of the high values from the 3 turns. The program should d incorporate at least 2 functions: Header this function accept no parameters and returns no values It prints out the game directions for the user Roll this function accepts an integer parameter which represents the number of dice that should be rolled this turn. It returns an integer value, which is the highest value from that turn The program should display all the dice values from each turn, and should report which value was the highest in each turn. The final score for the user and for the computer should he displayed The game results (tie. user wins, or computer wins) should be displayed

Explanation / Answer

please rate - thanks

hope this helps

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <time.h>
void header();
int roll(int);
int main()
{srand(time(0));
int scoreC=0, scoreH=0,dice,n;
header();
for(dice=3;dice>0;dice--)
{printf("Your rolls ");
   n=roll(dice);
   printf("you kept the %d ",n);
   scoreH+=n;
   printf("my rolls ");
   n=roll(dice);
   printf("I kept the %d ",n);
scoreC+=n;
printf("Score You %d, me %d ",scoreH,scoreC);
}
printf(" final score ");
printf("Human: %d ",scoreH);
printf("Computer: %d ",scoreC);
if(scoreC>scoreH)
    printf("Computer wins ");
if(scoreC<scoreH)
    printf("Human wins ");
else
    printf("Tie Game ");
getch();
return 0;

}
void header()
{printf("each player takes 3 turns ");
printf("insert more information here ");
printf(" ");
}
int roll(int n)
{int d,max=0,i;
for(i=0;i<n;i++)
    {d=rand()%6+1;
    printf("%d ",d);
    if(d>max)
        max=d;
        }
printf(" ");
return max;
}