c语言输出字符串汉字

#include <stdio.h>
#include <string.h>
int main()
{
float score;
int temp;
char grade[5];
printf("please input the score; ");
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 ", score, grade);
return 0;
}

运行结果:

原文地址:https://www.cnblogs.com/duanqibo/p/14117964.html