
CodePudding user response:
Don't know where is wrong




CodePudding user response:
About when you perform input function input format is wrong, so that the scanf failed,CodePudding user response:
The teacher should be defined as a character array, see using the % s in the input function, if still use character, so the % s will lead to cross here, because the % s to receive characters, at least 2 characters, because also account for a character '\ 0',In the same way with % s output in the print the teacher
So, it is recommended that the original poster to define the teacher as a character array, such as char the teacher [32].
Define array length suggest that definition into 2 n times the size of the power, the n anticipation of the array length according to you decide,
CodePudding user response:
Line 28 outputprintf (" % s % d % d % d % s \ n ",, the teacher's name is a string output, so the structure should be changed to:
Cla [I]. Num, cla [I]. Name, cla [I] the teacher, cla [I] term, cla [I] person);
struct Class {
Int num.
Char name [10].
Char the teacher [10].//the teacher name is the string
Int term;
Int the person;
};