I'm trying to pass all the values stored in the array to another function. I'm fairly new to using arrays with functions so first of all I'm not sure if im doing it right but heres what I'm trying to accomplish.
Get the daily sales of a store for a whole year from a text file and store them in an array. Then I'm using that array throughout different functions to process the data and output it. It's not close to being done so dont nit pick it quick yet but I'm just having problems passing the values.
This is the error I get:
1 2 3
Error 1 error LNK2019: unresolved external symbol "double __cdecl dataProcessing(void)" (?dataProcessing@@YANXZ) referenced in function _main C:\Users\Cody\Documents\School\C++\CIS276\DailySales\DailySales.obj DailySales
Error 2 error LNK1120: 1 unresolved externals C:\Users\Cody\Documents\School\C++\CIS276\DailySales\Debug\DailySales.exe DailySales
int main()
{
int menuOption;
//Function prototypes
int menu();
double inputFile();
double dataProcessing();
//Functions
menuOption = menu();
inputFile();
dataProcessing();
return 0;
}
/*********************************************
Input Function
* opens text file and inputs the sales into an array
* if file fails to open, an error message is displayed and why
**********************************************/
double inputFile()
{
double dailySales[365] = {0};
ifstream salesFile;
salesFile.open ("DailySales.txt");
//Test to see if the file was successfully opened and
//if not produces an error and states why
if (salesFile.is_open())
{
cout << "File opened\n" << endl;
}
else
{
perror("File Failed to open");
return 1;
}
//Assigns the values to the correct spots in the array
for(int i = 0; i < 365; i++)
{
salesFile >> dailySales[i];
}
return 0;
}
/*********************************************
Processing Function
* make variables for the months
* make sure every month has the right number of days
* place the correct data into catergories for the months
* calculate the average for a month if chosen
* calculate the average for the year if chosen
* calculate the total sales for the year
* calculate the total sales for a month
* calculate the highest selling month
* calculate the lowest selling month
**********************************************/
double dataProcessing(int menuOption, double dailySales[365])
{
string month;
int date;
switch(menuOption)
{
case 1:
do
{
cout << "Date : ";
getline(cin,month);
cin >> date;
}while((month != "Janurary" || month != "janurary") || (month != "Feburary" || month != "feburary")
|| (month != "March" || month != "march") || (month != "April" || month != "april")
|| (month != "May" || month != "may") || (month != "June" || month != "june") || (month != "July" || month != "july")
|| (month != "August" || month != "august") || (month != "September" || month != "september")
|| (month != "October" || month != "october") || (month != "November" || month != "november")
|| (month != "December" || month != "december"));
if(month == "Janurary" || month == "janurary")
{
if(date > 0 || date < 32)
{
cout << "$ " << dailySales[date];
}
}
}
return 0;
}