Passing arrays in functions

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



And here is my code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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;
}
for you error http://www.cplusplus.com/forum/general/113904/#msg622050

> I'm trying to pass all the values stored in the array to another function.
¿where do you think that you are passing them?
Topic archived. No new replies allowed.