lease explain the code with comments!!

Please explain the code with comments!!

C programming Measurement analysis

Using computer programs for measurement of data collection and analysis is very common.

You should write a well-structured program where you can enter measurement values ​​and analyze them.

/* Please remember to include comments to the code */

When the program starts, the user gets a menu where he can choose:

v (View) – displays the measured values ​​stored

e (Enter) – allows the user to add measurement values

​​c (Compute) – presents max, min, mean and normalized metrics

r (Reset) – deletes all input measured values ​​

q (Quit) quites the program .

The user must make his choice by entering a letter.

(View ).Displays the program values ​​currently stored in the program. Must be able to handle zero metrics.

(Enter). The user can enter the measured values ​​(positive integers) here until he inputs zero or the total number of measured values ​​stored is ten.

Then the entry ends and the user returns to the main menu. Note that if the user selects this option multiple times, the new metrics will be added. Previously entered measurement values ​​should remain. If you choose this option when the program already contains ten measured values, you can not enter any new values.

(Compute ).Uses the current data stored in the program to calculate and present: Max – the maximum value Min – the minimum value .

Average – the average of all measurement data. Note that this should be calculated as a decimal and presented with two decimals. Normalized measurement values ​​- In this case, normalized measurement values ​​mean subtracting the mean value from each measurement value and rounding to integers.

If you have measured values ​​[2 5 7] you get normalized measurement values ​​[-3 0 2] and these are to be presented.

Clarification: Arrays should be used correctly and efficiently with appropriate loop constructions. The program should properly divide its work with functions and send data between functions using in-parameters and returned values. No global variables are allowed.

The program should consist of a main function which should contain the code for our menu.

Menu choices one to four (and preferably five) should be handled in a function called when the user makes each selection. The menu selection calculator function, in turn, will call help features to solve its tasks. Output should look like this:

The output should be like this:

Measurement tool



[No measurements ] VECRQ ?

e Enter measurement # 1 (or 0) ?1

Enter measurement # 2 (or 0 ) ? 2

Enker mucsurement # 3 (or 0) ? 3

Enter measurement # 4 (or 0) ? 0

VEC RQ? v [1 2 3]


Enter measurement # 4 (or 0 ) ? 4

Enter measurement # 5 (or 0) ? 5

Enter measurement #6 (or 0)? 0

VECRQ ? v [1 2 3 4 5]


c Max value: 5 Min value : 1 Avr Value : 3.00 [ -2 -1 0 1 2] VECRQ ,

Exit measurement tool!

Expert Answer


// C code
#include <stdio.h>

// function to view current measurements in array
void viewMeasurements(int msr[], int count)
if(count == 0)
printf(“[No measurements]n”);
for(int i = 0; i < count-1; i++)
printf(“%dt”, msr[i]);
printf(“%d]n”, msr[count-1]);

// read measurements from userr and store it in array
void readMeasurements(int msr[], int *count)
// iterate over the index and take measurement values
while(*count < 10)
printf(“Enter measurement # %d (or 0) ? “, *count + 1);
scanf(“%d”, &msr[*count]);
if(msr[*count] > 0)

// function to computer average and find min max measurement
void computeValues(int msr[], int count)
int min, max;
min = max = msr[0];
double sum = 0;

// dteerime sum of measurement data and min and max measurement
for(int i = 0; i < count; i++)
if(msr[i] < min)
min = msr[i];
if(msr[i] > max)
max = msr[i];
sum += msr[i];

// the average of all measurement data.
double avg = sum / (double)count;

// print min max and average
printf(“Max value: %dn”, max);
printf(“Min value: %dn”, min);
printf(“Avg value: %.2fn”, avg);

// print measurement values
for(int i = 0; i < count-1; i++)
printf(“%.2ft”, msr[i] – avg);
printf(“%.2f]n”, msr[count-1] – avg);

void resetMeasurements(int *count)
*count = 0;

// main method
int main()
// choice to take input from user
char choice;
// measurement array
int measurements[10];
int numOfValues = 0;
printf(“Measurement tooln”);

// while looop to take input from user until done
// take input from user
printf(“VECRQ? “);
scanf(” %c”, &choice);

// switch case which calls appropriate function for each choice value
case ‘V’:
case ‘v’: viewMeasurements(measurements, numOfValues); break;

case ‘E’:
case ‘e’: readMeasurements(measurements, &numOfValues); break;

case ‘C’:
case ‘c’: computeValues(measurements, numOfValues); break;

case ‘R’:
case ‘r’: resetMeasurements(&numOfValues); break;

case ‘Q’:
case ‘q’: printf(“Exit measurement tool!n”); break;

default: printf(“Invalid choice. Try again.n”);
// q is chosen y user , quit the code
if(choice == ‘q’ || choice == ‘Q’)

// output

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.


Let us write that nagging essay.


Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.


Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.


Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.


Receive your Paper

After Editing, your paper will be sent to you via email.

× How can I help you?