C/C++の宿題やらせてください。9代目
■ このスレッドは過去ログ倉庫に格納されています
0858853
NGNG頭いいなあこのコード。おれが作ったのは何のひらめきも感じられないw
#include <stdio.h>
#include <string.h>
int main(int argc, char * argv[]) {
char line[1024], *p, *start;
int in_comment = 0;
while (fgets(line, sizeof(line), stdin)) {
if (!in_comment) {
if ((p = strstr(line, "/*")) != NULL) {
p += 2;
memmove(line, p, strlen(p) + 1);
in_comment = 1;
}
}
if (in_comment) {
if ((p = strstr(line, "*/")) != NULL) {
*p ='\0';
in_comment = 0;
}
fputs(line, stdout);
}
}
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています