+= operators , -=operators

Hello There. Can someone help me to modify my program so that the add opperations is
+ = operators & - = operators ?


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

int inputoption();

int inputoption()
{
	char option;
	cout<<"Your opening balance is RM1000.00"<<endl;
	cout<<"Enter any one of the following options: "<<endl;
	cout<<"0.\tQuit"<<endl;
	cout<<"1.\tDeposit"<<endl;
	cout<<"2.\tWithdrawal"<<endl;
	cout<<"3.\tBalance"<<endl;
	cout<<"Your option: ";

	do
	{
		cin>>option;
		if(option!='0' && option!='1' && option!='2' && option!='3')
		{
			cout<<"Invalid option." <<endl;
			cout<<"Pleae enter again." <<endl;
		}
	}
	while(!(option>='0' && option<='3'));
	return option;
}
int main()
{
	double const opb=1000.00;
	double cb=0;
	double amount;
	int userchoice;
	userchoice=inputoption();
	do
	{
    if (userchoice=='0')
	{
		break;
	}
	else if(userchoice=='1')
	{
		cout<<"Amount to Deposits: RM ";
		cin>>amount;
		cb=opb+amount;
	}
	else if(userchoice=='2')
	{
		cout<<"Amount to Withdraw: RM ";
		cin>>amount;
		cb=opb-amount;  
		while(cb<=10.00)
		{
		cout<<"Sorry, a minumum balance of RM10.00 is required."<<endl;
		cout<<"Please enter a new amount or 0 to quit."<<endl;
		cout<<"Amoun to Withdraw: RM ";
		cin>>amount;
		cb=opb-amount;
		}
	}
	else if(userchoice=='3')
	{
		cout<<"Your current balance is RM "<<cb<<endl;
	}	
	cout<<"Your current balance is RM "<<cb<<endl;
	}while(true);
	system("pause");
	return 0;
}
Last edited on
variable += value is variable = variable + value.

Doesn't work with your program.
Topic archived. No new replies allowed.