Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part 1: ------- Write a program that provides the user with a simple menu that i

ID: 3620332 • Letter: P

Question

Part 1:
-------
Write a program that provides the user with a simple
menu that includes the following options:
1. Sort data by the float value & print high to low
2. Sort data by the float value & print low to high
3. Sort data by the int value & print high to low
4. Sort data by the int value & print low to high
5. Exit

Of course, the menu must repeatedly be displayed until
the user selects the "exit" option. You should use a
do-while loop to accomplish this.

Part 2:
-------
Your program must call a function that opens a file of
unknown size and returns the size to main, then create a
dynamic array of struct, then populate that array, and
finally enter into the menu loop.

The file will be called input.data. The file will contain
a string, a float, an int and string. Below is a sample
file:

Azthusd Wifd 230 3.0
Qitwldf Aotirj 242 4.0
Sidfjw Fgher 263 2.0
Kdfgw Sdert 442 3.0
Luriend Gerisj 451 2.0

Part 3:
-------
For menu options 1, 2, 3 & 4 your program must call a
function that sorts the data by the appropriate
component. Since we are sorting the data by 2 different
components you are allowed to have 2 different sort
functions. But, ONLY 2!

Part 4:
-------
For menu options 1, 2, 3 & 4 your program must also call
a function that prints the resulting data. Since you must
print the data high to low or low to high, you are allowed
to have 2 routines. But, only 2!






Explanation / Answer

Part 1: #include #include void Integerass(int a[],int n) { int i,j,t; for(i=n-2;i>=0;i--) { for(j=0;ja[j+1]) { t=a[j]; a[j]=a[j+1]; a[j+1]=t; } } }//end for 1. }//end function. void Integerdss(int a[],int n) { int i,j,t; for(i=n-2;i>=0;i--) { for(j=0;j=0;i--) { for(j=0;j