c语言更改编译时字体,c习题编译时出现空的字符常量,怎么修改?
生活随笔
收集整理的這篇文章主要介紹了
c语言更改编译时字体,c习题编译时出现空的字符常量,怎么修改?
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
題目要求:統計各個數字,空白符以及所有其他字符出現的次數。
[CODE]#include
main()
{
int c, i, nwhite, nother;
int ndigit[10];
nwhite = nother = 0;
for (i = 0; i < 10; ++i)
ndigit[i] = 0;
while ((c = getchar()) != EOF)
if (c >= ’0′ && c <= ’9′)
++ndigit[c - '0'];
else if (c == ” || c == ‘\n’ || c == ‘\t’)
++nwhite;
else
++nother;
printf(“digits = “);
for (i = 0;? i < 10; ++i)
printf(” %d”, ndigit[i]);
printf(“, white space = %d, other = %d\n”, nwhite, nother);
}[/CODE]
提示:
[CODE]amro:~/doc/c$ gcc -o 1.6.1.out 1.6.1.c
1.6.1.c:16:25: 錯誤: 空的字符常量[/CODE]
請問怎么修改呢?謝謝
總結
以上是生活随笔為你收集整理的c语言更改编译时字体,c习题编译时出现空的字符常量,怎么修改?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python合并路径和文件名_Pytho
- 下一篇: 鸿蒙os 芯片制程,华为Mate50将如