Runtime Error

foo.cc: In function 'int main()':
foo.cc:20:61: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'char (*)[20]' [-Wformat=]
   scanf("%d%c%d%f",&s[i].name,s[i].num,&s[i].sex,&s[i].score);
                    ~~~~~~~~~~                               ^
foo.cc:20:61: warning: format '%c' expects argument of type 'char*', but argument 3 has type 'int' [-Wformat=]
foo.cc:36:69: warning: format '%d' expects argument of type 'int', but argument 2 has type 'char*' [-Wformat=]
   printf("%-8d%-8c%8-d%-8.0f",s[i].name,s[i].num,s[i].sex,s[i].score);
                                                                     ^
foo.cc:36:69: warning: unknown conversion type character '-' in format [-Wformat=]
foo.cc:36:69: warning: format '%f' expects argument of type 'double', but argument 4 has type 'int' [-Wformat=]
foo.cc:36:69: warning: too many arguments for format [-Wformat-extra-args]
foo.cc:20:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%c%d%f",&s[i].name,s[i].num,&s[i].sex,&s[i].score);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Hydro](https://hydro.ac)提供评测服务
# 状态 耗时 内存占用
#1 Runtime Error Segmentation fault 1ms 384.0 KiB

信息

递交者
类型
递交
题目
P1151 结构体-学生信息处理3
语言
C++
递交时间
2021-11-10 20:01:18
评测时间
2021-11-10 20:01:18
评测机
分数
0
总耗时
1ms
峰值内存
384.0 KiB