Hi.
Im making a program which uses an array from the main function and passes it to a function which displays a table.
However i am having a problem with calling the function in the main.
When i compile my program it shows error LNK2001 (unresolved external symbol).
Thanks for your help.
#include <iostream>
#include <cmath> #include <iomanip>
using namespace std;
void table(double, double);
int main()
{
double q;
cout << "Enter Q: ";
cin >> q;
const double PI = 4.0 * atan(1.0);
double array1[61];
int s;
double i;
double array2[61];
for (s = 0; s < 61; s++)
{
step = s *(PI)/30.0 ;
array1[s] = 1.0/PI + (1.0/2) * sin(step) - 2.0/PI * ( (1.0/3) * cos(2 * step) + (1.0/15) * cos(4 * step) + (1.0/35) * cos(6 * step) );
array2[s] = array1[s] * q;
}
table(array1 [61], array2[61]);
return 0;
}
void table( double array1[61],double array2[61])
{
const double PI = 4.0 * atan(1.0);
double var2;
double var1;
int k;
cout << "DISPLAY \n";
cout << endl;
for(k=0; k<=20; k++)
{
var2 = x *12;
var1 = var2 * PI;
cout << "| " << var2 << " " << var1 << " " << array2[k] << " |" << endl;
}
}