C/C++の宿題を片付けます 99代目 at TECH
[2ch|▼Menu]
370:デフォルトの名無しさん
07/11/12 17:54:23
>>367先越された
#include<stdio.h>
void prArry(const int a[const], size_t sz)
{
size_t idx = 1;
while( idx != sz - 2 )
{
if( 2*a[idx] > a[idx-1] + a[idx+1] ) printf("%d\n",a[idx]);
++idx;
}
return;
}
void prHeqT(const int a[const], size_t sz)
{
size_t idx = 0;
while( 2*idx <= sz )
{
if( a[idx] == a[sz-1-idx] ) printf("%d\n",idx);
++idx;
}
return;
}

int main(void)
{
const int a[] = {1,2,4,1,55,32,1,4,7,6};
prArry(&a[0],sizeof(a)/sizeof(int));
prHeqT(&a[0],sizeof(a)/sizeof(int));
return 0;
}




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

4817日前に更新/222 KB
担当:undef