Question: Cansomebody fix my code pls???? I will leave the instructions so you know how to follow the program. // My code: #define _CRT_SECURE_NO_WARNINGS #include #include

 Cansomebody fix my code pls???? I will leave the instructions so

Cansomebody fix my code pls???? I will leave the instructions so you know how to follow the program.

// My code:

#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #define SIZE 150

typedef struct

{

char name[50];

int score;

} student;

void display_array(int n, struct data[SIZE]) // note: see previous definition of 'display_array'

{

int d = 1, sum = 0;

int data;

char ck;

float avg = 0;

while (d

{

printf("Output Student Name: %c", ck[d]);

printf(" Score: %d", data[d]);

d++;

}

for (d = 0; d

{

sum = sum + cnit150[d].score;

avg = (float)sum / n;

}

printf(" Average Score is: %.2f", avg);

};

void myInfo();

int main()

{

student cnit150[SIZE];

int k = 1;

char c;

myInfo();

printf("Enter information of students: ");

while (k

{

int score;

printf("Enter name of student: ");

scanf(" %c", &c);

printf("Enter score: ");

scanf("%d", &score);

printf(" ");

k++;

if (score == -1)

break;

else

cnit150[k].score = score;

cnit150[k].name = c;

}

printf("Displaying Information: ");

display_array(cnit150[i].name, cnit150[i].score);

// (1.)'function': 'char' differs in levels of indirection from 'char [50]' //

// (2.)'display_array': different types for formal and actual parameter 1

// (3.)'function': 'student *' differs in levels of indirection from 'int'

// (4.)'display_array': different types for formal and actual parameter 2

_getch();

return 0;

}

void display_array(int n, struct student cnit150[SIZE])

{ // error C2084: function 'void display_array(char,student *)' already has a body

int d = 1, sum = 0;

float avg = 0;

while (d

{

printf("Output Student Name: %s", cnit150[d].name);

printf(" Score: %d", cnit150[d].score);

}

for (d = 0; d

{

sum = sum + cnit150[d].score;

avg = (float)sum / n;

}

printf(" Average Score is: %.2f", avg);

}

void myInfo()

{

// error C2084: function 'void myInfo()' already has a body

printf("\t************************************ ");

printf("\t*\tMyinfo\t * ");

printf("\t*\tMyinfo\t * ");

printf("\t*\tMyinfo\t * ");

printf("\t*\tMyinfo\t * ");

printf("\t************************************ ");

}

Named Constant: Declare size of the array = 150 as a named constant. Structure: Declare an abstract data type (stauct) with global scope to hold a name and a score as follows typedef struct char name201; int score: StudentRecord; Required function a. Input Parameters: none b. Output: void. c. Task: display your info in a box of star 2) displaarray() a. Input Parameters: Array of struct and number of students stored in the array b. Output: void. c. Task: display students stored in the array in tabular format. Provide column headers int main () Declare an array of struct to store up to 150 students data. Name this array cnit105. Declare other variables as needed Write a loop to partially fill the array in a loop. Use -1 as sentinel value o Prompt the user to enter student's test score. read it into a local variable o If score is -1, o break out of the loop o Otherwise, store the score in the array o Prompt the user to enter student's name - " Read it into the array of struct in the name member After the loop, display the number of students stored in the array Invoke display axato display all the students stored in the array to the Screen. Compute the average score Write a loop to add up the scores Divide the sum by # of entries. o o Display the average with 2 digits after the decimal point

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!