using the structure below: struct student { Char stdID[4] //stores employee ID c
ID: 3618475 • Letter: U
Question
using the structure below:struct student
{
Char stdID[4] //stores employee ID
char stdName[30] //stores employee Name
float grade
float hours
};
using the structure above create a function below that adds a newstudent to an array. the user should be asked to enter the id ofthe new student and asked to enter the students name. theargument the function takes in is the student structure and the intargument is the previous # of students on the list. also thenames appear on the list as "1234 Jim Johnson 12 16" therefore,there are spaces in between each of the data types and will need tobe stored this way.
int add(student[], int) - add a new student to end ofarray. set grade and hours to zero and return new total # ofstudent
Explanation / Answer
please rate - thanks if the id is 4 characters, you have to allocate 5, the last for theNULL #include using namespace std; struct student { char stdID[5]; //stores employee ID char stdName[30] ;//stores employee Name float grade; float hours; }; int add(student[], int); int main() {int count=0; student a[20]; count=add(a,count); coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.