In your C program define MAX to 100 define Create an array o
In your C program, define MAX to 100. (#define)
Create an array of MAX studentMarkvariables. (The struct type has been declared for you in C program)
Declare a studentMarkvariable that will be used to storea single student id and the associated mark.
Use a do-while loop to control the data entry process.
Output Example:
####### Marks Analyzer V3.0 #######
Enter student id and marks (e.g. 12345 89.5): 12345 55.55
Enter student id and marks (e.g. 12345 89.5): 23456 66.66
Enter student id and marks (e.g. 12345 89.5): 34567 77.77
Enter student id and marks (e.g. 12345 89.5): 45678 88.88
Enter student id and marks (e.g. 12345 89.5): 99999 -1
1. 12345, 55.55
2. 23456, 66.66
3. 34567, 77.77
4. 45678, 88.88
Solution
Code:
#include <cstdio>
#include <limits.h>
#define MAX 100
struct studentMarkVariable
{
float id;
float marks;
};
int main()
{
studentMarkVariable* arrs[MAX];
int count=0;
do
{
printf(\"Enter student id and marks (eg. 12345 89.5):\ \");
scanf(\"%f\",&(arrs[count]->id));
scanf(\"%f\",&(arrs[count]->marks));
count++;
}while(count<5);
count=0;
do
{
printf(\"%f %f\ \",arrs[count]->id , arrs[count]->marks);
count++;
}while(count<5);
return 0;
}

