Hello again. I am getting an LNK 2019 error to the following program. What am I doing wrong?:
#include <iomanip>
#include <iostream>
#include <fstream>
using namespace std;
const int ARRAY_SIZE = 100;
typedef char NameType[20];
void getList(int count, NameType delDate[ARRAY_SIZE], int zipCode[ARRAY_SIZE], int distance[ARRAY_SIZE], double cost[ARRAY_SIZE],
NameType custName[ARRAY_SIZE]);
int main()
{
NameType delDate[ARRAY_SIZE];
int zipCode[ARRAY_SIZE];
int distance[ARRAY_SIZE];
double cost[ARRAY_SIZE];
NameType custName[ARRAY_SIZE];
int count;
//Read file into Array
getList(count, delDate, zipCode, distance, cost,
custName);
system("pause");
return 0;
}
void getList(int count, NameType delDate[ARRAY_SIZE], int zipCode[ARRAY_SIZE], int distance[ARRAY_SIZE], double cost[ARRAY_SIZE],
NameType custName[ARRAY_SIZE])
{
ifstream inputFile;
ifstream inputFile2;
//Open the file
inputFile.open("shipment.txt");
inputFile2.open("zipMIcity.txt");
if (inputFile.fail())
{
cout << "ERROR: File not found" << endl;
cout << endl;
}
if (inputFile2.fail())
{
cout << "ERROR: File not found" << endl;
cout << endl;
}
//Read the numbers from the file into the array
while (count < ARRAY_SIZE && inputFile >> delDate[count] >> zipCode[count] >> distance[count] >> cost[count] >> custName[count])
count++;
I don't know why, but try including #include <string> .
Or maybe don't define ARRAY_SIZE in the declaration and definition of getList like so: void getList(int count, NameType delDate[], int zipCode[], int distance[], double cost[], NameType custName[]);