Home > Back-end >  Structure array function call assignment problem
Structure array function call assignment problem

Time:09-29

//struct4. CPP: defines the entry point of the console application,
//

# include "stdafx. H"
#include
#include
Struct student {
Int num.
Char name [10].
Float score [3].
};
Void print (struct student s) {
Printf (" % d % s % f % f, % f \ n ", s.n um, s.n ame, s.s core [0], s.s core [1], s.s core [2]).
}
Void input (struct student s) {
The scanf (" % d % s % f % f % f ", & amp; S.n um, s.n ame, & amp; S.s core [0], & amp; S.s core [1], & amp; S.s core [2]);
}
Int _tmain (int arg c, _TCHAR * argv [])
{struct student s [3].
for(int i=0; i<3; I++) {
[I] input (s);
}
for(int j=0; j<3; J++) {
[j] print (s);
}
system("pause");
return 0;
}
  • Related