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