Question
Write C program YOU MUST NOT Use global variables YOU MUST NOT Use the word goto YOU MUST NOT Use the break command outside a
Write C program
YOU MUST NOT Use global variables
YOU MUST NOT Use the word goto
YOU MUST NOT Use the break command outside a case statement
DO NOT ignore comments
Here is the outline,, complete
/*
REQUIRED
You must have a menu that loads information, stores information in an array(s)
Everything written in functions
Prohibit user from incorrect choices
Must include loops,switches,and decision statements
*/
#include
#include
#define _CRT_SECURE_NO_WARNINGS
#define CLS system(cls)
#define PAUSE system(pause)
#define SIZE 1000
//Prototype Directives---
void displayMenu();
char getChoice();
Int getWeight();
Int main() {
char choice;
Int weight [SIZE] = { 0 };
int i = 0;
do {
choice = getChoice();
switch (choice) {
Case1: '1'; // asks for weight
break;
Case2: '2'; //
break;
Case3: '3'; //gives average, high and low of weights
break;
Case4: '4'; //
break;
Case5: 'Quit'; // Quit the program
break;
default:
printf("Invalid Choice");
PAUSE;
break;
}//end switch
} while (choice != 'Q');
}//end main
void displaymenu(){
CLS;
printf(1.Enter Weight );
printf(2. Display Average of weights);
printf(3. Display Lowest Weights);
printf(4.
printf(5.
printf(6. Search );
printf(7. Quit );
}//end displayMenu
char getChoice() {
char result;
displayMenu();
scanf_s("%c", &result);
return toupper(result);//Make it an Uppercase letter
}//end getChoice
Int result;
int getWeight(){
printf(Enter Weight: );
scanf_s(%i, &result);
return result;
}//end getWeight
//int n, i ;
Float [SIZE] , sum=0.0 , average;
printf(Enter the Average )
scanf(%d, &n);
While (n > 1000 || n
{
}
2nd
//***********************************************************************************************************
#define PAUSE system("pause")
#define CLS system("cls")
#define SIZE 1000
#define _CRT_SECURE_NO_WARNINGS
#include
#include
//PROTOTYPE FUNTIONS HERE******
double averageWeight(double getWeights, double weights[10]);
void displayMenu();
int getChoice();
double getWeights();
int main() {
char choice;
float grades[SIZE] = { 0 };
int count = 0;
do {
choice = getChoice();
switch (choice) {
case 1: // asks for weights
getWeights();
break;
case 2: // gives average of weights
averageWeight(double getWeights, double weights[10]);
break;
case 3: //adds weights together and stores them in array
break;
case 4:
break;
case 5:
break;
case 6: //Quit the program
return 0;
break;
default:
break;
}//end switch
} while (choice != 'Q');
PAUSE;
}//end main
double averageWeight(double getWeights, double weights[10]) { //******************
int weights, i;
double total = 0.0, average;
for (i = 0; i
total += weights[i];
}//end of loop
average = total / 5;
printf("The average rainfall is %.2lf ", average);
PAUSE;
}//end averageWeight
void displayMenu() {//****************
CLS;
printf("1. ");
printf("2. ");
printf("3. ");
printf("4. ");
printf("5. ");
printf("6. ");
}//end displayMenu
int getChoice() {//*****************
int result;
displayMenu();
scanf_s("%i", &result);
return result;
}//end getChoice
double getWeights() {//***************
double weights[10] = { 0.0 };
int i;
for (i = 0; i
printf("Enter a weight amount for person %i: ", i + 1);
scanf_s("%lf", &weights[i]);
}//end for
}//end getWeights
PerfectOka Poor Your Pts [Comments Theme for Program Design Tool Comments and Documentation Look and Feel Functions Array Use Passing Arravs Sort Function Searching Arrays Error Checkin Menu System Program does something that makes sense 4 4 4 4 10 10 10 10 4 4 4 4 Total Pts 100Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started