C/C++の宿題を片付けます 102代目
■ このスレッドは過去ログ倉庫に格納されています
0484483
2008/01/10(木) 08:34:06#include <stdio.h>
int main()
{
char str[4][35]={"A time to work",
"And a time to play",
"I think I will find another way",
"It's not my time to go" };
int i,j,count=0;
for(i=0;i<4;++i){
for(j=0;j<35;++j){
if(str[i][j]==' ') {count+=1;}
}
}
printf("単語数=%d",count+4);
/*1行につき「(単語数)=(空白文字数)+1」で、それが4行分*/
}
■ このスレッドは過去ログ倉庫に格納されています