【初心者歓迎】C/C++室 Ver.28【環境依存OK】
■ このスレッドは過去ログ倉庫に格納されています
0718京大生www
2006/06/26(月) 19:37:34int compare (char *s1, char *s2) {
int i;
char new_s1[20];
for (i=0; i<20; i++) {
new_s1[20] = toupper(s1[i]);
}
return strcmp(new_s1, s2);
}
strcmpの進化版みたいのを作ったつもりですがうまく作動しません。
どこが間違っているのでしょうか?
ちなみにここで使います。見てのようにどうせ小文字しかないのでstrcmpで代用したらうまく動きました。
上のはどこが間違っているのでしょうか。
void search_record(word *eng, int current_num, char *search_string){
int i;
int count=0;
for (i=0; i<current_num; i++){
if(strcmp(eng[i].spelling, search_string)==0) {
printf("%s\n", eng[i].spelling);
count += 1;
}
}
printf("以上%d件がヒットしました", count);
}
■ このスレッドは過去ログ倉庫に格納されています