Question

In: Computer Science

C Programming Game Scores Assignment Outcome: Student will demonstrate the ability to design a menu driven...

C Programming

Game Scores Assignment

Outcome:

Student will demonstrate the ability to design a menu driven program.

Student will demonstrate the ability to create and use a 2D array on

the stack.

Student will demonstrate the use of functions.

Student will demonstrate good programming style.

Program Specifications:

***********************************************

** MAIN MENU **

***********************************************

A) Enter game results

B) Current Record (# of wins and # of losses and # of ties)

C) Display ALL results from all games WON

D) Display ALL results ordered by opponent score from low to high.

E) Quit

Your program will have a menu similar to the example above. The game

results will simply be the score by your team and the score by your

opponent. The user will enter a single game result at a time. This

assignment requires the use of a 2D array. You will not need the date of

the game or the names of the teams. All cases will be written within user

defined function. Functions should be used as much as possible.

Submission Requirements:

Requirements will be same as the first assignment which will be the same

for all future assignments.

YOU CANNOT

Use global variables, in this or any program ever.

Use goto statement(s), in this or any program ever.

Note for the tutor : Please create a design tools after you done with the work

Solutions

Expert Solution

Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

#include <stdio.h>
#include <stdlib.h>

int main(){
int n;
int A[100];
int B[100];
int games = 0;
while (1){
printf("%s ","***********************************************");
printf("%s ","** MAIN MENU **");
printf("%s ","***********************************************");
printf("%s ","A) Enter game results");
printf("%s ","B) Current Record (# of wins and # of losses)");
printf("%s ","C) Display ALL results from all games WON");
printf("%s ","D) Display ALL results");
printf("%s ","E) Quit");
printf("ENter Your Choice (1-5) : ");
scanf("%d",&n);
if (n == 1){
while (1){
printf("%s","Enter Your Score (-1 to Quit) ");
int input;
scanf("%d",&input);
if (input == -1)
break;
A[games] = input;
printf("%s","Enter Your Opponent Score (-1 to Quit) ");
scanf("%d",&input);
B[games] = input;
games += 1;
}
}
else if (n == 2){
int i = 0;
int wins = 0;
int loss = 0;
while (i < games){
if (A[i] > B[i])
wins += 1;
else
loss += 1;
i += 1;
}
printf("Wins : %d ",wins);
printf("Loss : %d ",loss);
}
else if (n == 3){
int i = 0;
while (i < games){
if (A[i] > B[i])
printf("game: %d Status: Win ",(i+1));
i += 1;
}
}
else if (n == 4){
int i = 0;
while (i < games){
if (A[i] > B[i])
printf("game: %d Status: Win ",(i+1));
else
printf("game: %d Status: Loss ",(i+1));
i += 1;
}
}
else
break;
}
}



Kindly revert for any queries

Thanks.


Related Solutions

Car Race Outcome: Student will demonstrate the ability to generate random numbers Student will demonstrate the...
Car Race Outcome: Student will demonstrate the ability to generate random numbers Student will demonstrate the ability to use a switch statement with cases Student will demonstrate the ability to use loop structures Student will demonstrate the ability to create program logic Student will demonstrate the ability to produce nicely formatted output Program Specifications: You will design a simulated car race. The race will consist of three cars: car A, car B, and car C. Your program will show the...
C++ Programming Develop and submit an original implementation of a menu-driven program performing a number of...
C++ Programming Develop and submit an original implementation of a menu-driven program performing a number of tasks relating to student marks scored in a number of assessments including: displaying all marks, adding new student marks, calculating the mean score, median score, finding the minimum and maximum scores as well as displaying the average mark of a given student. The problem: Student marks are kept in a text file as a single column. Each student may have a different number of...
Programming II: C++ - Programming Assignment Vector Overloads Overview In this assignment, the student will write...
Programming II: C++ - Programming Assignment Vector Overloads Overview In this assignment, the student will write a C++ program that overloads the arithmetic operators for a pre-defined Vector object. When completing this assignment, the student should demonstrate mastery of the following concepts: · Object-oriented Paradigm · Operator Overloading - Internal · Operator Overloading - External · Mathematical Modeling Assignment In this assignment, the student will implement the overloaded operators on a pre-defined object that represents a Vector. Use the following...
"Gambling Greg" Assignment Outcomes: Demonstrate the ability to create and use structs Demonstrate the ability to...
"Gambling Greg" Assignment Outcomes: Demonstrate the ability to create and use structs Demonstrate the ability to create and use menus Demonstrate the ability to create and use an array of structs Demonstrate the ability to generate and use random numbers Program Specifications: Assume that gambling Greg often goes to the Dog Racing Track. Greg loves to bet on the puppies. In each race Greg will place a wager and pick a dog. The dog information will be stored in a...
Playing with strings Assignment Outcomes: Demonstrate the ability to create strings. Demonstrate the ability to manipulate...
Playing with strings Assignment Outcomes: Demonstrate the ability to create strings. Demonstrate the ability to manipulate strings. Demonstrate the ability to write well written code. Program Specifications: DESIGN and IMPLEMENT a short program that will: Allow the user to enter a string with up to 100 letters. Display the user-entered string: Forward Backward Vertical As a triangle made from the letters of the string Display the number of letters in the string. Once everything above is displayed, the program will...
Struct PERSON Assignment Outcomes: Demonstrate the ability to create structs using typedef Demonstrate the ability to...
Struct PERSON Assignment Outcomes: Demonstrate the ability to create structs using typedef Demonstrate the ability to create an array of structs Program Specifications: DESIGN and IMPLEMENT a program that will CREATE and use three different variables of type PERSON. Create a struct using the typedef command for a DATE. Create a struct for a PERSON with the following fields. name [this will be a string] birthdate [this will be a DATE] gender [this will be a char] annualIncome [this will...
Struct PERSON Assignment Outcomes: Demonstrate the ability to create structs using typedef Demonstrate the ability to...
Struct PERSON Assignment Outcomes: Demonstrate the ability to create structs using typedef Demonstrate the ability to create an array of structs Program Specifications: DESIGN and IMPLEMENT a program that will CREATE and use three different variables of type PERSON. Create a struct using the typedef command for a DATE. Create a struct for a PERSON with the following fields. name [this will be a string] birthdate [this will be a DATE] gender [this will be a char] annualIncome [this will...
Struct PERSON Assignment Outcomes: Demonstrate the ability to create structs using typedef Demonstrate the ability to...
Struct PERSON Assignment Outcomes: Demonstrate the ability to create structs using typedef Demonstrate the ability to create an array of structs Program Specifications: DESIGN and IMPLEMENT a program that will CREATE and use three different variables of type PERSON. Create a struct using the typedef command for a DATE. Create a struct for a PERSON with the following fields. name [this will be a string] birthdate [this will be a DATE] gender [this will be a char] annualIncome [this will...
Programming Language: C++ Overview For this assignment, write a program that will simulate a single game...
Programming Language: C++ Overview For this assignment, write a program that will simulate a single game of Craps. Craps is a game of chance where a player (the shooter) will roll 2 six-sided dice. The sum of the dice will determine whether the player (and anyone that has placed a bet) wins immediately, loses immediately, or if the game continues. If the sum of the first roll of the dice is equal to 7 or 11, the player wins immediately....
Write a simple menu-driven program called “Million Dollar Game”. The dice that we are using for...
Write a simple menu-driven program called “Million Dollar Game”. The dice that we are using for this game are special oriental dice. Each die has six different patterns. The six possible patterns are: Fish, Shrimp, Crab, Chicken, goldenCoin, Barrel. This game has three dice. In this game, the player can place his or her bet on any die-pattern. The amount of the winning prize is directly proportional to the number of matched dice after the two dice have been tossed...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT