event controlled do-while loop help


.
Last edited on
should look somthin like this. I can't test this bc I have an error that makes absolutly no sense in the one "For" loop. I know there's mistakes in here bc i'm still new to this. but here is what I got

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
98
99
100
101
102
103
#include <iostream>
#include <cstdio>
#include <cstdlib>
 

using namespace std;


char cResponse;
	double dDepositAmount[];
	double dTotalDeposits;
	int x;  //deposit count
	double dAverageDeposit;
double dothemath();
double dDoTheAverage();
int i;
main()
	{
		
		cout<<"Would you like to make a deposit? y or n";
		cin>>cResponse;

		switch(cResponse)
			{case 'y':
		
					break;

			case 'Y':
				
					break;

			case 'n' : 
				system("EXIT");
					break;

			case 'N' :
				system("EXIT");
					break;
		}

		
while(dDepositAmount > 0)
		{x = x++;
		cout<<"To See Average Deposit Amount Enter A Number <0 \n";
		cout<<"Enter Deposit Amount";
		cin >> dDepositAmount[x];
cout<<"You Entered"<<dDepositAmount[x];

		if(dDepositAmount<0)
			dDoTheAverage( dTotalDeposits, x);
		else
		dothemath(dDepositAmount,x);
		}
system("PAUSE")                              // I know this is a no no but i havn't made my own delay() yet
}




double dothemath(double dDepositAmount[],int x)
{
	for(i=0,i<x,i++)
	{
		dDepositAmount[i+1] = dDepositAmount[i] + dDepositAmount[i+1] ;

		dTotalDeposits = dDepositAmount[i+1];
	}
	return dTotalDeposits;
}


 double dDoTheAverage(double dTotalDeposits,int x)
 {
	 cout<<"The Average Of The Total Of Your Deposits Is : \n";
	cout<<(dTotalDeposits / x);


//how would i set this part of the problem up? I have an idea but not exactly sure

//Declare variables

//userResponse: character (y or n)

//depositAmount: floating point

//totalDeposits: floating point

//depositCount: integer

//averageDeposit: floating point



//ยท Loop until user responds no

//Prompt and input deposit amount

//Add deposit amount to total deposits

//Increment deposit count (i know to use depositcount++ for this)

//Prompt and input user's response (y or n)
//ico 
Last edited on
Topic archived. No new replies allowed.