C言語なら俺に聞け! Part 135©5ch.io
■ このスレッドは過去ログ倉庫に格納されています
0259デフォルトの名無しさん
2016/05/25(水) 22:09:08.78ID:mqK6DNQr次にtempmax2に対しても同じ計算をする。但し、c[i]<tempmax1を果たす。
要するに、最高得点を超えない場合の最高得点を求めればよい。
double tempmax1 = c[0],tempmax2 = c[0];
int no1=0,no2=0;
for( i=0; i<5; i++)
{
if(c[i]>tempmax1)
{
tempmax1 = c[i];
no1=i;
}
}
for( i=0; i<5; i++)
{
if(c[i]>tempmax2 && c[i]<tempmax1)
{
tempmax2 = c[i];
no2=i;
}
}
printf("合格(A):%d人目 %d点\n",no1+1,(int)tempmax1);
printf("合格(A):%d人目 %d点\n",no2+1,(int)tempmax2);
■ このスレッドは過去ログ倉庫に格納されています