C/C++の宿題を片付けます 93代目at TECH
C/C++の宿題を片付けます 93代目 - 暇つぶし2ch978:デフォルトの名無しさん
07/07/26 18:17:28
// >>974
#include <stdio.h>
#include <string.h>
#include <stdbool.h>

bool isPalindrome(const char * word)
{
unsigned len = strlen(word);
if (len == 0) return false;
for (unsigned ic = 0; ic < len / 2; ++ic) {
if (word[ic] != word[len - 1 - ic]) return false;
}
return true;
}

int main()
{
char buf[200];
scanf("%199[^\n]", buf);
printf("%s is%s palindrome.\n", buf, isPalindrome(buf) ? "" : " not");
return 0;
}



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