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

#C language array must store at least 50 inputs Game Scores Assignment Outcomes: Demonstrate the ability...
#C language array must store at least 50 inputs Game Scores Assignment Outcomes: Demonstrate the ability to create a menu driven program. Demonstrate the ability to create and use a 2D array on the stack. Demonstrate the use of functions. Demonstrate good programming style. Program Specifications: Your program will read in "game scores" from the user. Each score consists of a score for YOUR team and a score for the OTHER team. You don't need names or dates for the...
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...
"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...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT