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

Please write the attached \'C\' Programming assignments and submit c files and w

ID: 3797610 • Letter: P

Question

Please write the attached 'C' Programming assignments and submit c files and word/text docs as documented in the detailed instructions below. Thank you so much

****All programs must be written using the VC++ 2015 compiler****

A) Required Items/Software:

Visual C++ 2015 (Visual Studio 2015 Professional or Visual Studio Express 2015) MS Word or Notepad WinZip (or similar)- for extracting files

Textbook: PROGRAMMING IN C, 4th Edition Stephen G Kochan.

2. There are many games in which six-sided dice are used to determine a random outcome of the game being played. The dice numbered 1-6 can be represented with 7 characters across and 5 characters down and a lower case 'o' for each dot on a die: O O O O o I o I o o I o o l o O l Professor C. is writing a game that uses dice like these in his program. Write a C program that will print the dice for him. The input will be a randomly generated value from 1 to 6. Do not hard code the dice values- they must be algorithmically calculated. Also, do not use an array. Refer to the sample output below Sample Runs (2): Dice Value: 3 Dice Value 1 Name the program: DiceDisplayXX.c, where XX are your initials.

Explanation / Answer

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;

void print(int num){
for(int i = 0; i < 7; i++){
printf("-");
}
printf(" ");

printf("| ");
if(num > 1) printf("o ");
else printf(" ");
if(num > 3) printf("o ");
else printf(" ");
printf("| ");

printf("| ");
if(num == 6) printf("o");
else printf(" ");
if(num % 2 == 1) printf("o");
else printf(" ");
if(num == 6) printf("o ");
else printf(" ");
printf("| ");

printf("| ");
if(num > 3) printf("o ");
else printf(" ");
if(num > 1) printf("o ");
else printf(" ");
printf("| ");

for(int i = 0; i < 7; i++){
printf("-");
}
printf(" ");
}

int main(){
srand(time(0));
int dice = rand() % 6 + 1;
printf("Dice Value: %d ", dice);
print(dice);
}