/************************************/
/*文件复制*/#include <stdio.h>
main()
{
int c;
c = getchar();
while(c != EOF)
{
putchar(c);
c = getchar();
}
} /*********************************/ /*字符计数*/
#include <stdio.h>
main()
{
double nc;
for(nc=0;getchar()!=EOF;++nc)
;
printf("%.0f\n",nc);
} /***********************************/ /*行计数*/
#include <stdio.h>
main()
{
int c,n1;
n1 = 0;
while((c=getchar())!= EOF)
if(c == '\n')
++n1;
printf("%d\n",n1);
} /*****************************************/ /*单词计数*/
#include <stdio.h> #define IN 1 /*在单词内*/
#define OUT 0 /*在单词外*/
/*统计输入的nl行数、nc单词数与nw字符数*/
main()
{
int c,n1,nw,nc,state;
state = OUT;
n1 = nw =nc = 0;
while((c = getchar()) != EOF)
{
++nc;
if(c == '\n')
++n1;
if(c == ' ' ||c = '\n' c == '\t')
state = OUT;
else if (STATE == OUT)
{
state = IN;
++nw;
}
}
printf("%d %d %d\n",n1,nw,nc);
}