C/C++の宿題片付けます 128代目at TECH
C/C++の宿題片付けます 128代目 - 暇つぶし2ch112:デフォルトの名無しさん
09/06/27 17:44:30
ポインタなしver.がないので
isalphaの行をどうにかマクロにしたかったw

int is_anagram(const char str[]) {
    int head, tail, len;
    head = 0; tail = (len=strlen(str))-1;
    for ( len /= 2; head < len && len < tail; head++, tail-- ) {
         if ( !isalpha(str[head]) ) { head++; continue; }
         if ( !isalpha(str[tail]) ) { tail--; continue; }
         if ( tolower(str[head]) != tolower(str[tail]) )
             return 0;
    return 1;
    }
}



次ページ
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch