❶ 请问c语言,最后是显示出学号和对应的各科成绩怎么编程
基本思路是使用结构体。
如:
structstudent//包含学号,数学成绩,英语成绩,计算机成绩
{
intnum;
intmath;
intenglish;
intcomputer;
};
这样使用:
structstudenta;
a.num=1;
a.math=59;
a.english=69;
a.computer=79;
printf("%d,%d,%d,%d ",a.num,a.math,a.english,a.computer);
不懂就追问,满意请采纳!
❷ c语言成绩等级编写
#include<stdio.h>
intmain()
{
intscore;
printf("inputascore:");
scanf("%d",&score);
if(score>100||score<0)
printf("输入数据错误 ");
else
{
switch(score/10)
{
case9:case10:
printf("A ");break;
case8:
printf("B ");break;
case7:
printf("C ");break;
case6:
printf("D ");break;
default:
printf("E ");break;
}
}
return0;
}
❸ C语言 从键盘输入一个班的成绩 怎么用while语句实现的程序代码
#include<stdio.h>
int main()
{
float score;
char grade;
printf("请输入学生成绩:");
scanf_s("%f", &score);
while (score>100||score<0)
{ printf("\n输入有旦斗芦误,销凳请重新输入!");
scanf_s("%f"模带, &score); }
switch ((int)(score / 10))
{
case 10:
case 9:grade = 'A'; break;
case 8:grade = 'B'; break;
case 7:grade = 'C'; break;
case 6:grade = 'D'; break;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:grade = 'E';
}
printf("学生成绩是%5.1f:,等级是:%C。\n", score, grade);
}
❹ 输入百分制成绩对应输出优良中及格不及格的成绩等级c语言用swich表达
代码如下亏高袜:
#include <stdio.h>
int main()
{
int grade;
printf("请输入成销激绩: ");
scanf("%d", &grade);
switch (grade / 10)
{
case 10:
case 9:
printf("优. ");
break;
case 8:
printf("良. ");
break;
case 7:
printf("中念陵. ");
break;
case 6:
printf("及格. ");
break;
default:
printf("不及格. ");
}
return 0;
}