//Write a program that reads student's names followed by their ID and test scores.
//student data should be stored in a struct variable of type studenttype which has
//3 members: name ,ID, and test score. Declare array ITCS104students of size 7 of elements of type studenttype.
//add the following functions to your program:
//* a function to read all members of your array.
//* a function to print name and ID of the student with the highest test score.
# include <iostream>
# include <string>
usingnamespace std;
struct studentType
{
string name;
long ID;
int testscore;
};
void Readallmembers(studentType &arr)
{
cout << "Enter name ID and test score =\n";
cin >> arr.name >> arr.ID >> arr.testscore >> endl;
}
void Printallmembers(studentType &arr)
{
cout << "Name= " << arr.name << endl;
cout << "ID=" << arr.ID <<endl;
cout << "Test Score=" << arr.testscore <<endl;
}
int main()
{
studentType ITCS104students[5];
for(int i=0 ; i<5 ; i++)
Readallmembers(ITCS104students[i]);
for(int i=0 ; i<5 ; i++)
Printallmembers(ITCS104students[i]);
return 0;
}
i put every thing up there the question is there and my solve is there , there is syntax error i want some one to check it to me and fix it >> i think its clear my friend
No, it wasn't clear. Your OP did not state that you were getting a syntax error.
How were we supposed to know that was your problem?
You could have posted the error text along with your code.
Line 25: You can't do a cin to endl. endl is an ostream manipulator.
Next time please state what you are trying to do, what you are expecting to happen, what is happening and if applicable, exact error messages (not reworded; copy and paste them).
The users here aren't always going to look through every line of your code to find what is wrong, they are expecting something to start off with. Error messages are really helpful with that.