homework help needed

I am getting error ERROR: error C2065: 'smallCups' : undeclared identifier, I have listed it in the code where I get it and I have added relevant code to show what I am trying to do.. We are not allowed t use Global Variables.

so I am trying to pass the returned total for smallCups between functions... I have tried to add static and it doesn't like that either...

any help would be greatly appreciated C++ is not my strong point....

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
const double small = 1.75; 
const double medium = 1.90;
const double large = 2.00;
int size1(int smallCups);		 

.....

void option1()
{
		bool optionMenu = true;
		int size;

		while (optionMenu != false)
		{
			cout << "Please select the SIZE Coffee you would like:\n";
			cout << " 1: Small\n";
.....

			if (size == 1)
			{
				size1(smallCups);  
                                //?????? ERROR: error C2065: 'smallCups' : undeclared identifier
			}

......

		}

.....

int size1(int smallCups)
{


	cout << "You have selected size: SMALL\n";
	cout << "The price is \x9C" << small <<"\n";
	cout << "Number of Cups?\n";
	cin >> smallCups;
	
	
	return smallCups;
}

double price()
{
	double priceSCups, priceMCups, priceLCups, totalPrice = 0.00;
	int smallCups = size1(smallCups);
.....

	setprecision(2);
	priceSCups = small * smallCups;
......
	return totalPrice;
}
1
2
3
4
5
double price()
{
    double priceSCups, priceMCups, priceLCups, totalPrice = 0.00;
    int smallCups = size1(smallCups);
//                           ↑Where is that smallCups declared? 
Change
1
2
3
int size1(int smallCups)
{
	int smallCups

and accordingly:
int smallCups = size1(smallCups);
1
2
3
			if (size == 1)
			{
				int smallCups = size1(smallCups);
Topic archived. No new replies allowed.