【C语言】成绩等级制

将成绩分为A、B、C、D、E等级。具体的等级划分如下:

  • A:90分及以上

  • B:80分到89分

  • C:70分到79分

  • D:60分到69分

  • E:60分以下

    cpp 复制代码
    #include <stdio.h>
    int main()
    {
    	float score = 0;
    	printf("请输入学生成绩(0-100):");
    	scanf("%f", &score);
    	switch ((int)(score / 10))
    	{
    	case 10:
    	case 9:printf("%.1f分,等级为A\n",score); break;
    	case 8:printf("%.1f分,等级为B\n", score); break;
    	case 7:printf("%.1f分,等级为C\n", score); break;
    	case 6:printf("%.1f分,等级为D\n", score); break;
    	default:printf("%.1f分,等级为E\n", score);
    	}
    	return 0;
    }

相关推荐
RuoZoe1 天前
重塑WPF辉煌?基于DirectX 12的现代.NET UI框架Jalium
c语言
祈安_4 天前
C语言内存函数
c语言·后端
郑州光合科技余经理6 天前
代码展示:PHP搭建海外版外卖系统源码解析
java·开发语言·前端·后端·系统架构·uni-app·php
feifeigo1236 天前
matlab画图工具
开发语言·matlab
dustcell.6 天前
haproxy七层代理
java·开发语言·前端
norlan_jame6 天前
C-PHY与D-PHY差异
c语言·开发语言
多恩Stone6 天前
【C++入门扫盲1】C++ 与 Python:类型、编译器/解释器与 CPU 的关系
开发语言·c++·人工智能·python·算法·3d·aigc
QQ4022054966 天前
Python+django+vue3预制菜半成品配菜平台
开发语言·python·django
czy87874756 天前
除了结构体之外,C语言中还有哪些其他方式可以模拟C++的面向对象编程特性
c语言
遥遥江上月6 天前
Node.js + Stagehand + Python 部署
开发语言·python·node.js