-2

I have to make 2 arrays and use functions to input, output, add, and compare them but I keep getting error message: undefined reference to outputVLI(int*, int). I am not sure what this means or how to fix it. Any help would be appreciated

#include <iostream>
using namespace std;

const int maxDigits = 100;
void inputVLI (int vli[], int size);   // Inputs the very long integers
void outputVLI (int vli[], int size); // Outputs the very long integers
void addVLI (const int vli1[], const int vli2[], int vli3[], int size1, int size2, int& size3); // Adds the very long integers together
int compVLI (const int vli1, const int vli2, int size1, int size2); // Compares the very long integers

int main()
{
    int vli1[maxDigits], vli2[maxDigits], vli3[maxDigits], size1, size2, size3;
    inputVLI (vli1, maxDigits);                                 // Calls the individual functions
    outputVLI (vli1, maxDigits);                                // |
    inputVLI (vli2, maxDigits);                                 // |
    outputVLI (vli2, maxDigits);                                // |
    /*addVLI (vli1, vli2, vli3, size1, size2, size3);           // |
    compVLI (vli1, vli2, size1, size2);*/                       // \/
    return 0;
}

void inputVLI(int vli[], int size)
{
    cout << "Enter a very long integer" << endl;
    cin >> vli[maxDigits];
}

void output (int vli[], int size)
{
    for (int i=maxDigits; i>=0; i--)
        cout << vli[i];
}

void addVLI (const int vli1[], const int vli2[], int vli3[], int size1, int size2, int& size3)
{
/*
    for (int i=0; i<maxDigits; i++)
    {
        vli3[i]=vli1[i] + vli2[i];
        cout << "The sum of the vli's is:" << vli3[i] << endl;
    }
*/
}

int compVLI (const int vli1, const int vli2, int size1, int size2)
{
/*
    for (int i=0; vli1[maxDigits] && vli2[maxDigits]; i++)
    {
        if (vli1[maxDigits] != vli2[maxDigits])
        {
            return (-1); // -1 is not equal
        }
        return (1); // 1 is equal
    }
*/
}
too honest for this site
  • 12,050
  • 4
  • 30
  • 52

1 Answers1

0

Your outputVLI function is declared, but not defined. So, you should add the definition:

void outputVLI(int vli[], int size) {
    // TODO: implementation here
}

Also, your compVLI functions needs to return a value...

Community
  • 1
  • 1
miha
  • 3,287
  • 3
  • 29
  • 44
  • I don't know what you mean, hows it not defined? – awpirates9 May 04 '16 at 21:31
  • Have a look at the answer I linked to. You need to declare your function (i.e. `void foo();`) and you need to define your function (i.e. `void foo() {}`). You can skip declaration if you define your function prior to using it. – miha May 05 '16 at 06:15