C言語質問スレ【激初心者】
■ このスレッドは過去ログ倉庫に格納されています
0838デフォルトの名無しさん
2005/11/26(土) 19:26:46例外処理は考慮してない。
#include<stdio.h>
#include<string.h>
char s[64];
int word[64];
int main(void){
char tmp[64];
int i, offset;
fgets(s,64,stdin);
for(i = offset = 0; sscanf(s+offset,"%[^ .\n]%*c",tmp) == 1; i++) {
word[i] = strlen(tmp);
offset += word[i] + 1;
}
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています