c语言输出字符串汉字


#include <stdio.h>
#include <string.h>
int main()
{
float score;
int temp;
char grade[5];
printf("please input the score;\n");
scanf_s("%f", &score);
temp = (int)score / 10;
switch (temp)
{
case 10:
case 9: strcpy_s(grade,"一等"); break;
case 8:strcpy_s(grade, "二等"); break;
case 7:strcpy_s(grade, "三等"); break;
case 6:strcpy_s(grade, "四等"); break;
default: strcpy_s(grade, "五等");
}
printf("score=%.1f,grade=%s\n", score, grade);
return 0;
}

运行结果:

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM