📄 l5.1d
字号:
#printWrite a program that counts the blanks, tabs, and newlinesin its input, and prints the total. Don't forget todefine the value of EOF at the beginning of your program.The best way is to add #include <stdio.h>as the first line of your program.The ____must be in column 1.(See page 143 of the C book.)You may also have to saycc name.c -lSto compile the program.#once #create RefThis is some junk thatcontains blanks tabs and newlines.#usera.out <Ref >test1a.out </dev/null >test2grep 13 test1 >/dev/null || grep 0 test2 >/dev/null#succeedOne possible solution: #include <stdio.h>main(){ int n, c; n = 0; while ((c = getchar()) != EOF) if (c == ' ' || c == '\t' || c == '\n') n++; printf("%d\n", n);}This program won't work on huge files, because an intisn't big enough.#log#next5.1e 105.2e 5
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -