C言語なら俺に聞け(入門篇) Part 23
■ このスレッドは過去ログ倉庫に格納されています
0246デフォルトの名無しさん
2007/12/27(木) 14:22:54????のところ(該当しなかった場合)が思いつきません。
助けてくださいです…
char a[20];
char b[20];
int hi,lo,i;
略
hi=i;
i=i/2;
lo=0;
while(1){
if(strcmp(b,a) < 0){
hi=i;
i=i-(hi-lo)/2;
}else if(strcmp(b,a) > 0){
lo=i;
i=i+(hi-lo)/2;
}else if(strcmp(b,a) == 0){
printf("あった");
break;
}else if( ???? ){
printf("そんなものなかった");
break;
}
}
■ このスレッドは過去ログ倉庫に格納されています