C/C++の宿題を片付けます 86代目
■ このスレッドは過去ログ倉庫に格納されています
0775デフォルトの名無しさん
2007/05/08(火) 07:57:57#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define STR_SIZE (128+1)
int my_tolower(int ch){ return islower(ch) ? ch : ch - ('A' - 'a'); }
int comp_char(const char *p, const char *q){ return *p - *q; }
int main(){
int i;
char buf[STR_SIZE], *p;
fgets(buf, STR_SIZE, stdin);
if((p =strchr(buf, '\n')) != NULL) *p = '\0';
for(p = buf; *p != '\0'; p++) *p = my_tolower(*p);
qsort(buf, strlen(buf), sizeof(char), (int (*)(const void *, const void *))comp_char);
puts(buf);
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています