C/C++の宿題片付けます 127代目
■ このスレッドは過去ログ倉庫に格納されています
0220デフォルトの名無しさん
2009/06/11(木) 22:45:43#include <stdio.h>
#define BUF_SIZE 81
bool IsCharOfWord(char c)
{
return (c!=' ' && c!='\t' && c!='\n' && c!='.' && c!=',');
}
int main() {
int pFront, pEnd;
char buf[BUF_SIZE];
if (fgets( buf, BUF_SIZE, stdin ) == NULL) return 1;
for (pFront=0;pFront<BUF_SIZE && buf[pFront]!='\0';pFront++)
{
if (!IsCharOfWord(buf[pFront])) continue;
for (pEnd=pFront+1;buf[pEnd]!='\0';pEnd++)
{
if (!IsCharOfWord(buf[pEnd]))
{
buf[pEnd] = '\0';
break;
}
}
printf("%s\n", &buf[pFront]);
pFront = pEnd;
}
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています