IO1.0
#include <stdio.h> /* 将输入复制到输出;版本1 */ main() { int c; c = getchar(); while(c != EOF){ putchar(c); c = getchar(); } }
IO2.0
#include <stdio.h> /* 将输入复制到输出;版本2 */ main() { int c; while((c = getchar()) != EOF){ putchar(c); } }
nc1.0
#include <stdio.h> /* 统计输入的字符数;版本1 */ main() { long nc; nc = 0; while(getchar() != EOF) ++nc; printf("%ld\n", nc); }
nc2.0
#include <stdio.h> /* 统计输入的字符数;版本2 */ main() { double nc; for(nc = 0; getchar() != EOF; ++nc) ; /* 空语句 */ printf("%.0f\n", nc); }
nl1.0
#include <stdio.h> /* 统计输入的行数;版本1 */ main() { int c, nl; while((c = getchar()) != EOF) if(c == '/n') ++nl; printf("%d\n", nl); }
nbntnl1.0
#include <stdio.h> /* 统计输入的空格、制表符、换行符个数;版本1 */ main() { int c, nb, nt, nl; nb = 0; nt = 0; nl = 0; while((c = getchar()) != EOF){ if(c == ' '){ ++nb; } if(c == '\t'){ ++nt; } if(c == '\n'){ ++nl; } } printf("%d %d %d", nb, nt, nl); }
nbntnl2.0
#include <stdio.h> /* 统计输入的空格、制表符、换行符个数;版本2 */ main() { int c, nb, nt, nl; nb = 0; nt = 0; nl = 0; while((c = getchar()) != EOF){ if(c == ' '){ ++nb; } else if(c == '\t'){ ++nt; } else if(c == '\n'){ ++nl; } } printf("%d %d %d", nb, nt, nl); }