Я получаю следующую ошибку, и я не знаю, что это значит: Ошибка 1 ошибка LNK2019

0

ive есть некоторые проблемы. программа работала тогда, когда я разделил ее на каждую функцию, я получил эти ошибки:

Ошибка 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 : outPute против Output
Теги:

1 ответ

1

Ваш прототип функции:

int calcAVE(int [], int);

Ваша функция:

int calcAve(int theArray[], int ct)

C++ чувствителен к регистру. Следовательно, calcAVE is not the same as calcAve. У вас такая же проблема с вашей функцией вывода.

  • 0
    Спасибо, я не знал, в чем была ошибка. Вы, ребята, очень помогли

Ещё вопросы

Сообщество Overcoder
Наверх
Меню