لدي وخطأ دائماً مايظهر ولا أعرف ماهي الطريقة لتجنبه
هذا هو السؤال
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.
- 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>
using namespace std;
{
struct studenttype
{
string name;
long ID;
float testscore;
};
void Readallmembers(studenttype list[])
{
cout <<"Enter Name ID and test score: ";
cin >> arr.name >> arr.ID >> arr.testScore;
}
void Print(studenttype list[])
{
loc=0;
for(int i=1 ; i<5 ; i++)
if(list.testscore < list[loc].testscore)
loc=i;
}
cout << list[loc].name << list[loc].ID << list[loc].testscore;
int main()
{
studenttype ITCS104[5];
for(int i=0 ; i<5 ; i++)
Readallmembers(ITCS104student);
print(ITCS104student);
return 0;
}
}الخطأ error C2447: '{' : missing function header (old-style formal list?)
السطر الرابع

