何度もすいません前回の(http://www.play21.jp/board/formz.cgi?ac ... &rln=41929)のやつに
さらに単語数をつけたいのですが・・・
例this is a penだと
英単語数は4です
This 4letter
is 2letter
a 1letter
pen 3letter
という風に・・・が
#include<stdio.h>
int main(void)
{
int c;
int e;
e = 0;
while(1){
c = getchar();
if(c ==' ')
e++;
if(c == '\n')
{
printf("英単語数は%dです", e + 1);
break; }
}
while(1){
c = getchar();
if(c != '\n')
putchar(c);
e++;
if(c == ' ')
{
printf(": %d letters.\n", (e - 1));
e = 0;
}
if(c == '\n')
{
printf(": %d letters.\n", (e - 1));
break;
}
}
return 0;
}
とやると2回同じ単語をいちいち入力しなければならないのでgetcharを入力したら
再度もう一度同じ単語でやるというふうにはできないでしょうか?