2014-02-22 26 views
0

我有一些麻煩。程序工作,然後當我分裂成每個功能我得到這些錯誤:林得到以下錯誤,我不知道它是什麼意思:錯誤錯誤LNK2019

錯誤1錯誤LNK2019:無法解析的外部符號「int __cdecl calcAVE(int * const,int)」(?calcAVE @@ YAHQAHH @ Z)引用在函數_main c:\ Users \ Joshua \ documents \ visual studio 2013 \ Projects \ 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

錯字:'outPute'與'輸出' –

回答

1

你的函數原型:

int calcAVE(int [], int); 

你的功能:

int calcAve(int theArray[], int ct) 

C++是大小寫敏感的。因此,calcAVE is not the same as calcAve。你的輸出功能有同樣的問題。

+0

謝謝,我不知道錯誤是什麼。你們是一個很大的幫助 –

相關問題