// Description: This program calculates the average of a group of five test scores where the group is dropped.
#include <iostream>
using namespace std;
void getScore(double);
void findLowest(double, double, double, double, double, double);
void calcAverage(double, double, double, double, double, double);
int main()
{
double ix, iy, iz, iw, ib;
getScore(ix);
getScore(iy);
getScore(iz);
getScore(iw);
getScore(ib);
calcAverage(ix, iy, iz, iw, ib);
return 0;
}
void getScore(double score)
{
cout << "What is your score?";
cin >> score;
if (score < 0)
{
cout << "Error";
exit(0);
}
}
void findLowest(double ba, double bb, double bc, double bd, double be, double exclude)
{
if (ba < bb && ba < bc && ba < bd && ba < be)
exclude = ba;
else if (bb < ba && bb < bc && bb < bd & bb < be)
exclude = bb;
else if (bc < ba && bc < bb && bc < bd && bc < be)
exclude = bc;
else if (bd < ba && bd < bb && bd < bc && bd < be)
exclude = bd;
else
exclude = be;
}
void calcAverage(double aa, double ab, double ac, double ad, double ae, double drop)
{
double average;
findLowest(aa, ab, ac, ad, ae, drop);
average = (aa + ab + ac + ad + ae - drop)/4;
cout << "The test score we are dropping is " << drop << endl;
cout << "Your average is " << average << endl;
}
내가 35 번째 줄 (int main에서 calcAverage)에 충분한 인수를 가지고 있지 않으며 다른 변수를 넣을 때 주에있는 모든 것이 더 이상 초기화되지 않는다고 말합니다. 나는 혼란스럽고 왜 이런 일이 일어나고 있는지에 대해 혼란 스럽다.이 오류 코드를 해결하는 방법을 모르겠습니다. 오류 : 함수가 5 개의 인수를 취하지 않고 오류 : 함수 호출에서 인수가 너무 적습니다.
나는 ir 변수를 광고하려고하는데 다음과 같이 알려주고있다 : "초기화되지 않은 지역 변수"ix ""줄 29 –