/************************************/
/*文件复制*/
#include <stdio.h>
main()
{
int c;
c = getchar();
while(c != EOF)
{
putchar(c);
c = getchar();
}
}
#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 ",nc);
}
#include <stdio.h>
main()
{
double nc;
for(nc=0;getchar()!=EOF;++nc)
;
printf("%.0f ",nc);
}
/***********************************/
/*行计数*/
#include <stdio.h>
main()
{
int c,n1;
n1 = 0;
while((c=getchar())!= EOF)
if(c == ' ')
++n1;
printf("%d ",n1);
}
#include <stdio.h>
main()
{
int c,n1;
n1 = 0;
while((c=getchar())!= EOF)
if(c == ' ')
++n1;
printf("%d ",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 == ' ')
++n1;
if(c == ' ' ||c = ' ' c == ' ')
state = OUT;
else if (STATE == OUT)
{
state = IN;
++nw;
}
}
printf("%d %d %d ",n1,nw,nc);
}
#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 == ' ')
++n1;
if(c == ' ' ||c = ' ' c == ' ')
state = OUT;
else if (STATE == OUT)
{
state = IN;
++nw;
}
}
printf("%d %d %d ",n1,nw,nc);
}