Description of this paper

This is the C code that i need to re-write by using parallel arrays

Description

solution


Question

This is the C code that i need to re-write by using parallel arrays to hold the data in the output chart ("Roll" 2 - 12, "Session" data, and the "Expected" output) and use different looping structures, and use a loop to print your output AFTER you print your column headings ("Roll" 2 - 12, "Session" data, and the "Expected" output).;here is the code.;/*;PROGRAM DESCRIPTIVE HEADER;SOURCE CODE FILE NAME: GHP#7;PROGRAMMER: BAW HTOO;DESCRIPTION: THE PROGRAM IS TO ASK USER TIMES TO ROLL THE DICE TO PLAY THE GAME;ALGORITHM;STEP 1: WELCOME USER AND INTRODUCE THE GAME;STEP 2: ASK USER HOW MANY TIMES HE/SHE WANTS TO ROLL THE DICE;STEP 3: READ THE TOTAL OF THE TWO ROLLED DICE;STEP 4: DISPLAY THE RESULT TO THE USER;STEP 5: ASK THE USER IF HE/SHE WANTS TO RUN THE SIMULATION AGAIN;STEP 6: SIGN-OFF WITH USER;STEP 5: TERMINATE;CALL: a.out AFTER COMPILING WITH gcc (WITHOUT USING THE -o SWITCH);DATE SUBMITTED;BUGS: NONE DETECTED;*/;/*****************************************************************************/;/* #include PREPROCESSOR DIRECTIVE(S) (IF ANY) ARE DIRECTLY BELOW */;/*****************************************************************************/;#include;#include;#include;#include;/*****************************************************************************/;/* #define PREPROCESSOR DIRECTIVE(S) (IF ANY) ARE DIRECTLY BELOW */;/*****************************************************************************/;/*****************************************************************************/;/* typedef DEFINITION(S)/DECLARATION(S) (IF ANY) ARE DIRECTLY BELOW */;/*****************************************************************************/;/*****************************************************************************/;/* PROGRAMMER-CREATED FUNCTION (PCF) PROTOTYPE(S) (IF ANY) ARE */;/* DIRECTLY BELOW */;/*****************************************************************************/;/*****************************************************************************/;/* GLOBAL VARIABLE(S) (IF ANY) ARE DECLARED DIRECTLY BELOW */;/*****************************************************************************/;/*****************************************************************************/;/* THE main() FUNCTION IS DECLARED DIRECTLY BELOW, THE main() FUNCTION */;/* ACCEPTS NO PARAMETERS/ARGUMENTS. THE main() FUNCTION RETURNS AN INTEGER */;/* VALUE OF ZERO TO THE OPERATING SYSTEM WHEN THE PROGRAM IS COMPLETE TO */;/* INFORM THE OPERATING SYSTEM THAT THE PROGRAM HAS SUCCESSFULLY TERMINATED.*/;/*****************************************************************************/;int main(void);{ // MARKS THE BEGINNING OF THE main() BLOCK OF STATEMENTS;/*****************************************************************************/;/* LOCAL VARIABLE(S) FOR main()(IF ANY) ARE DECLARED DIRECTLY BELOW */;/*****************************************************************************/;int die_1, die_2, total_dice, count, counter1, counter2;int rolls[]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};float percentage;float sum = 36;int dec=1;float times;char again = 'y;counter2=1;srand(time(NULL)), //NECESSARY FOR RANDOM NUMBERS;while(again=='y');dec = 1;// ALGORITHM STEP 1: WELCOME USER AND INTRODUCE THE GAME;printf("\n\n Welcome to the game of Craps. This program will ask you to roll the 2 dice. \n\n");// ALGORITHM STEP 2: ASK USER HOW MANY TIMES HE/SHE WANTS TO ROLL THE DICE;printf("How many times you want to roll two dice? ");scanf("%f", &×);// ALGORITHM STEP 3: READ THE TOTAL OF THE ROLLED DICE.;for (counter1=0, counter1

 

Paper#69032 | Written in 18-Jul-2015

Price : $32
SiteLock