c语言赋值变量

来源:百度知道 编辑:UC知道 时间:2024/05/10 13:52:46
用变量赋值的方法分别设定你和你的4个同学的11位学号及c语言的成绩(其中有个70分以下的)用if判断并输出70分以下的同学的学号及其成绩,并输出统计70分以下的人数!解决时11位学号大哥你自订

char *no_1 = "53223523001";
float sc_1 = 74.5;
char *no_2 = "53223523002";
float sc_2 = 64;
char *no_3 = "53223523003";
float sc_3 = 75.5;
char *no_4 = "53223523004";
float sc_4 = 90;
int num = 0;
if(sc_1 < 70)
{
num ++;
printf("No.%s,Score:%.2f\n",no_1,sc_1);
}
if(sc_2 < 70)
{
num ++;
printf("No.%s,Score:%.2f\n",no_2,sc_2);
}
if(sc_3 < 70)
{
num ++;
printf("No.%s,Score:%.2f\n",no_3,sc_3);
}
if(sc_4 < 70)
{
num ++;
printf("No.%s,Score:%.2f\n",no_4,sc_4);
}
printf("Number below 70 is:%d \n", num);

struct
{
float n;
float score;} stu[5];
void main()
{
int count=0;

for(i=0;i<5;i++)
scanf("%f%f",&stu[i].score,&stu[i].score);

for(i=0;i<