错误1错误LNK2019:函数_main c:\ Users \ Joshua \ documents \ visual studio 2013 \ Projects中引用了未解析的外部符号“int __cdecl calcAVE(int * const,int)”(?calcAVE @@ YAHQAHH @ Z) \ ConsoleApplication10 \ ConsoleApplication10 \ Source.obj ConsoleApplication10
请帮忙,谢谢。
#include <iostream>
using namespace std;
void getUserInput(int [], int&);
int calcAVE(int [], int);
void outPute(int [], int, int);
int main()
{
int theAverage = 0;
int ct = 0;
const int MAX_SIZE = 100;
int theArray[MAX_SIZE];
getUserInput(theArray, ct);
theAverage = calcAVE(theArray, ct);
outPute(theArray, ct, theAverage);
return 0;
}
void getUserInput(int theArray[], int& ct)
{
int quit = 0;
int theNums = 0;
int i = 0;
while (true)
{
cout << "please enter numbers, enter 0 to quit \n";
cin >> theNums;enter code here
if (theNums == quit)
{
break;
}
theArray[ct] = theNums;
ct++;
}
}
int calcAve(int theArray[], int ct)
{
int i = 0;
int total = 0;
int average = 0;
for (i = 0; i < ct; i++)
{
total += theArray[i];
average = total / ct;
}
return average;
}
void Output(int theArray [], int ct, int average)
{
int i = 0;
for (i = 0; i < ct; i++)
{
if (theArray[i] > average)
{
cout << theArray[i] << ", ";
}
}
}
答案 0 :(得分:1)
你的功能原型:
int calcAVE(int [], int);
你的职能:
int calcAve(int theArray[], int ct)
C ++区分大小写。因此,calcAVE is not the same as calcAve
。输出功能也有同样的问题。