C言語/C++言語の宿題を片付けます 65代目
■ このスレッドは過去ログ倉庫に格納されています
0283デフォルトの名無しさん
2006/06/06(火) 21:14:50#include <stdio.h>
int mycmp(char *s1, char *s2){
int i = 0, j = 0;
while(*(s1 + i) != NULL)i++;
while(*(s2 + j) != NULL)j++;
if(i != j)return 0;
while(*s1 != NULL){
if(*s1 != *s2)return 0;
s1++, s2++;
}
return 1;
}
int main(){
char tmp[256];
char s1[256], s2[256];
gets(tmp);
sscanf(tmp, "%s%s", s1, s2);
if(mycmp(s1, s2) == 1)puts("yes");
else puts("no");
return 0;
}
と作ってみたが、mycmp内でstrcmp呼べばいいんじゃないかとオモタ
■ このスレッドは過去ログ倉庫に格納されています