one more function problem

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
#include <iostream>
using namespace std;

double getSales( char, division[])
double findhighest(double, double, double);

int main()
{
	double sales1, sales2, sales3, high;
	char div1[15] = "Southeast"; 
	char div2[15] = "Southwest";
	char div3[15] = "Northeast";
	
	sales1 = getSales(div1);
	sales2 = getSales(div2);
	sales3 = getSales(div3);
	cout << "The sales for " << div1 << " are " << sales1 << endl;
	cout << "The sales for " << div2 << " are " << sales2 << endl;
	cout << "The sales for " << div3 << " are " << sales3 << endl;
	high =  findhighest (sales1, sales2, sales3);
	cout << endl << high << endl;
	return 0;
}
double getSales( char, division[])
{
	double sales;
	cout << "Get the sales for Division " << division << " ";
	cin >> sales;
	return sales;
}
double findhighest(double s1, double s2, double s3)
{
	
	if (s1 >= s2 && s1 >= s3)
		return s1;
	else if ( s2 >= s1 && s2 >= s3)
		return s2;
	else return s3;
	
}

i got errors on this code i'm suppose to figure out which of the company's 4 divisions had the greatest sales for the quarter. let me know if i'm missing something.
Last edited on
Could you tell us what errors you got or the lines they occurred on?
the errors are on lines 7,8,17,18,19,27,30.
Line 7 - indentifier 'division'
Line 8 - 'double' should be preceded by ';'
Lines 17,18,19 - cannot convert parameter 1 from 'char [15]' to 'char'
Line 27 - same as Line 7
Line 30 - 'division' : undeclared identifier
division [ ] does not appear to be declared or initialised
division does not appear to be declared
getSales () no char variable and no array type - doesn`t do much does it?
the char div1 [15] arrays should probably be string s1= "............. " because there is no code to print these arrays. If u change it would need the cstring header.
In this line, remove the comma
 
double getSales( char, division[])


and then compile it, it works

Topic archived. No new replies allowed.