Int main ()
{
Struct Stu {
Char name [100].
char sex;
int age;
float score;
Char addr [100].
} stu1 stu2;
Scanf_s (" % s % c % d % f, % s ", stu1. Name, & amp; Stu1 sex, & amp; Stu1. Age, & amp; Stu1 score, & amp; Stu1. Addr);
Scanf_s (" % s % c % d % f, % s ", stu2. Name, & amp; Stu2 sex, & amp; Stu2. Age, & amp; Stu2 score, & amp; Stu2. Addr);
If (stu1. Score & gt; Stu2. Score)
Printf (" % s % c % d % f, % s ", stu1. Name, stu1. Sex, stu1. Age, stu1. Score, stu1. Addr);
If (stu1. Score & lt; Stu2. Score)
Printf (" % s % c % d % f, % s ", stu2. Name, stu2. Sex, stu2. Age, stu2. Score, stu2. Addr);
If (stu1. Score==stu2. Score)
{
Printf (" % s % c % d % f, % s ", stu1. Name, stu1. Sex, stu1. Age, stu1. Score, stu1. Addr);
Printf (" % s % c % d % f, % s ", stu2. Name, stu2. Sex, stu2. Age, stu2. Score, stu2. Addr);
}
return 0;
}
0 xfefefefe in untreated exception (in Project51. Exe) : 0 xc00001a5: detect invalid exception handling routines, (parameters: 0 x00000003),
Seek advice
CodePudding user response:
scanf_s () is used to read the string, you must provide a number to indicate how many characters, most read in order to prevent overflow,Scanf_s (" % s ", buf, 5);//says most read four characters, because buf should put [4] '\ 0'
CodePudding user response: