Hi, I have a big project (#1). this is its direction:
Project I

Software for a Bank

Write a C++ program for the following task:
a) Should allow 5 users with user name & password [ (Ohlone1, Ohlone1pw), (Ohlone2, Ohlone2pw),( Ohlone3, Ohlone3pw), (Ohlone4, Ohlone4pw), (Ohlone5, Ohlone5pw)]

b) Display a welcome / greeting .

c) Menu driven program to allow ‘View Balance’, ‘Deposit’, ‘Withdraw’, ‘Transfer’ and ‘Exit’. Start with a beginning balance of 1000.00 in checking and 1500.00 in savings.

These are the general specifications, use your creativity to make program user friendly.


So far I've laid out the general scheme in the following code. But I have no idea how to do the depositing, withdrawing, or the transfering...worse yet...How can you show these amounts on the "view Balance"?
Do I have to repeat this for each and every user? Is there a simpler way to simplify this process?

//Term Project #1 - 100 points
//SOFTWARE FOR A BANK 
//Write a C++ program for the following task using modular approach.
//a)    Should allow  5 users with user name & password :
//[ (Ohlone1, Ohlone1pw), (Ohlone2, Ohlone2pw),( Ohlone3, Ohlone3pw), (Ohlone4, Ohlone4pw), (Ohlone5, Ohlone5pw)]
//b)    Display a welcome / greeting .
//c)    Menu driven program to allow: 
//‘View Balance’, 
//‘Deposit’, 
//‘Withdraw’, 
//‘Transfer’ 
//and ‘Exit’. 
//Start with a beginning balance of 1000.00 in checking and 1500.00 in savings.

#include <iostream.h>
#include <string.h>

//PROTOTYPE;
void Signin();
void Menu1();
void ViewBalance1();
void Ohlone1_balance();
void Ohlone1_Deposit();
void Ohlone1_Withdraw();
void Ohlone1_Transfer();
void Ohlone1_Checking();
void Ohlone1_Saving();


void main (void)
{

	cout << "WELCOME TO PROGRAMMING BANK!\n\n";
	cout << "~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~\n\n";
	Signin ();
	Menu1 ();
}

void Signin ()
{
	char username[31], PW[20];

	cout << "Please enter your username: \n";
	cin.width(32);
	cin >> username;
	do 
	{
		//User 1
		if (strcmp(username, "Ohlone1") ==0)
		{
			cout << "Please enter your password: \n";
			cin >> PW;
			for (int i = 0; i < PW; i++)
			{
				cout << "*";  //How come this technique deosn't work?
			}
			if (strcmp(PW, "Ohlone1pw") == 0)
				cout << "\n\n\tYou are logged in!\n\t";
			else 
			{
				cout << "Your password was entered incorrectly.\n";
				cout << "Please enter your password again.\n";
				cin >> PW;
				if (strcmp(PW, "Ohlone1pw") == 0)
					cout << "\n\n\tYou are logged in!\n\n";
				else 
				{
					cout << "I'm sorry you're having trouble.\n";
					break;
				}
			}
			return;
		}
		//User 2
		else if (strcmp(username, "Ohlone2") ==0)
		{
			cout << "Please enter your password: \n";
			cin >> PW;
			if (strcmp(PW, "Ohlone2pw") == 0)
				cout << "\n\n\tYou are logged in!\n\n";
			else 
			{
				cout << "Your password was entered incorrectly.\n";
				cout << "Please enter your password again.\n";
				cin >> PW;
				if (strcmp(PW, "Ohlone2pw") == 0)
					cout << "\n\n\tYou are logged in!\n\n";
				else
				{
					cout << "I'm sorry you're having trouble.\n";
					break;
				}
			}
			return;
		}
		//User 3
		else if (strcmp(username, "Ohlone3") == 0)
		{
			cout << "Please enter your password: \n";
			cin >> PW;
			if (strcmp(PW, "Ohlone3pw") == 0)
				cout << "\n\n\tYou are logged in!\n\n";
			else 
			{
				cout << "Your password was entered incorrectly.\n";
				cout << "Please enter your password again.\n";
				cin >> PW;
				if (strcmp(PW, "Ohlone3pw") == 0)
					cout << "\n\n\tYou are logged in!\n\n";
				else
				{
					cout << "I'm sorry you're having trouble.\n";
					break;
				}
			}
			return;
		}
		//User 4
		else if (strcmp(username, "Ohlone4") == 0)
		{
			cout << "Please enter your password: \n";
			cin >> PW;
			if (strcmp(PW, "Ohlone4pw") == 0)
				cout << "\n\n\tYou are logged in!\n\n";
			else 
			{
				cout << "Your password was entered incorrectly.\n";
				cout << "Please enter your password again.\n";
				cin >> PW;
				if (strcmp(PW, "Ohlone4pw") == 0)
					cout << "\n\n\tYou are logged in!\n";
				else 
				{
					cout << "I'm sorry you're having trouble.\n";
					break;
				}
			}
			return;
		}
		//User 5
		else if (strcmp(username, "Ohlone5") == 0)
		{
			cout << "Please enter your password: \n";
			cin >> PW;
			if (strcmp(PW, "Ohlone5pw") == 0)
				cout << "\n\n\tYou are logged in!\n\n";
			else 
			{
				cout << "Your password was entered incorrectly.\n";
				cout << "Please enter your password again.\n";
				cin >> PW;
				if (strcmp(PW, "Ohlone5pw") == 0)
					cout << "\n\n\tYou are logged in!\n\n";
				else
				{
					cout << "I'm sorry you're having trouble.\n";
					break;
				}
			}
			return;
		} 
	}while (strcmp(username, "Ohlone1") == 0 || (username, "Ohlone2") == 0 || 
		(username, "Ohlone3") == 0 || (username, "Ohlone4") ==0 || (username, "Ohlone5") == 0);
     
	if (strcmp(username, "Ohlone1") != 0 || (username, "Ohlone2") != 0 || 
		(username, "Ohlone3") != 0 || (username, "Ohlone4") !=0 || (username, "Ohlone5") != 0)
	{
		cout << "your enter your username incorrectly.\n";
		cout << "Please try again.\n";
	}
	return;
	}
void Menu1 ()
{
	int choice;

	cout << "\nWHAT WOULD YOU LIKE TO DO?\n";
	cout << "\n*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\n\n";
	cout << "\t1. View Your Balance.\n";
	cout << "\t2. Deposit.\n";
	cout << "\t3. Withdraw.\n";
	cout << "\t4. Transfer.\n";
	cout << "\t5. Exit.\n\n";
	cout << "Please enter your choice: \n";
	cin >> choice; 
	if (choice ==1)
	{
		Ohlone1_balance();
	}
	else if (choice ==2)
	{
		Ohlone1_Deposit();
	}
	else if (choice ==3)
	{
		Ohlone1_Withdraw();
	}
	else if (choice ==4)
	{
		Ohlone1_Transfer();
	}
	else if (choice ==5)
	{
		cout << "You have chosen to exit the menu.\n";
		cout << "Thank you for visiting Programming Bank.\n";
		return;
	}
}

void Ohlone1_balance ()
{
	//cout << "Your checking account has : " << << endl;
	//cout << "Your saving account has : " <<  << endl;
}

void Ohlone1_Checking (float *amount)
{
	//amount = 1000;

}

void Ohlone1_Saving (float *amount)
{
	//amount = 1500;
}

void Ohlone1_Deposit ()
{
	int input;
	float deposit; 

	cout << "Which account would you like to deposit to?\n";
	cout << "1. Checking Account\n";
	cout << "2. Saving Account\n";
	cin  >> input;
	if (input = 1)
	{
		cout << "How much do you want to deposit to the Checking Account?\n";
		cin >> deposit;
	}
	if (input =2)
	{
		cout << "How much do you want to deposit to the Saving Account?\n";
		cin >> deposit;
	}
}

void Ohlone1_Transfer ()
{
	int input;

	cout << "Would you like to transfer..\n\n";
	cout << "1. From CHECKING to SAVING\n";
	cout << "\nOR\n\n";
	cout << "2. From SAVING to CHECKING\n";
	cin >> input;
	if (input = 1)
	{
		// C_to_S ();
	}
	if (input = 2)
	{
		// S_to_C ();
	}
}

void Ohlone1_Withdraw ()
{
	int input;
	float withdraw;

	cout << "From which account would you like to withdraw?\n";
	cout << "1. Checking\n";
	cout << "2. Saving\n";
	cin >> input;
	if (input = 1)
	{
		cout << "How much would you like to withdraw from the Checking account?\n";
		cin >> withdraw;
		//what to do here? 
	}
	if (input = 2)
	{
		cout << "How much would you like to withdraw from the Saving account?\n";
		cin >> withdraw;
		//what to do here?
	}
}

I know it's really long. But can you guys help please?

Recommended Answers

All 13 Replies

Did you learn about structs or classes recently?

umm...no...I'm a level-1 beginner.
You can tell from my coding that I'm pretty much clueless in C++.

This is assignment. (The subsequent comparison is always true.)

if (input = 1)

This is comparison.

if (input == 1)

Ever here the phrase, "What happens in Vegas stays in Vegas" (or something similar)? Well, function are like that too. Whatever happens to a local variable inside a function is lost on the outside of that function. So if you want to keep track of something, you would want to be passing parameters to a function and returning values from them to "communicate" with one another.

Just outta curiosity, are you learning this stuff in a class, or from a book?

And everyone starts at level 1.

I'm just asking so that you go down the right path for the class, but if it's from a book and this is just for your own betterment, I'll show you how to do these things with structs and classes.

Aaaanyway: For your concerns about deposits, withdrawals, and transfers:
You should have two variables for monetary values. Savings and checking, let's call 'em.
What you do is you declare and initialize them like so:

float checking = 1000.;
float savings = 1500.;

and that gives you the initial values.

When you want to make a deposit, you need to specify checking or savings, and then add the appropriate amount (from user input) to the appropriate account.

Making a withdrawal is a little tougher. Once you've specified savings or checking, you need to make sure that the user doesn't overdraw their account. That means you have to use an 'if' statement to check that the amount of money to be withdrawn is less than or equal to the current value held in the account.


What you'd want is something like this:

float deposit(int account_type);
//Asks for amount to add, and returns the new value of the appropriate account.

float withdraw(int account_type); 
//Asks, Error checks the balance, returns the value of the balance if transaction is good. Otherwise, returns a -1.0

The transfers, though... That's a little odd.
You can't return two values from a function, you have to use pointers...

uh...to answer your question, Drowzee, I'm taking this introduction to C++ class in a college (ohlone, if you know the name) right now and it's in the summer. the class is normall 3 months long but since it's in the summer, it's only 6 weeks! WAHHH!! But the same materials have to be covered, so it's like 3 chapters a week! So even though, I'm taking the class, I'm basically on my own 'cause the teacher barely has time for lectures, let alone helping individual students (although all of my classmates seem to know what they're doing, I'm always the last one to turn in something, even tests).That's why I'm constantly asking for help. It took forever to figure out what I did wrong, or just to figure out what to do!

As I didn't see any rules against double posting in this fashion, I thought it best to split this off to help seperate the topic, as my last one was far too heavily edited and almost unusable.

Yes, your current code is far too redundant. If you ever have code that is repeated with only minor changes like the name entered, there's a better, faster way to do it.

Let me introduce you to your friend and mine, 'Switch'.
Switch is, for an integer input (like a menu choice), a very handy tool.

int menu_sel;

//Get your menu selection somehow.

switch(menu_sel){
       case 0:  //menu selection for, I dunno... Deposits.
            Your deposit function;
       case 1: //Let's say, withdrawals.
            your withdraw function;
       case 2: //for whatever else you want. Just keep adding cases.
       default: //This  must always be at the end of the  cases. It catches anything that wasn't supposed to come through. So, if someone enters G, it'll be caught here.
        break; //It's always a good idea to use 'break' in the default. Just do it, it's good, safe coding.
} //end of the switch statement.

That'll help a little. More importantly, you'll need to make it so that you have one generic login, not five. You can do this a number of ways, but the lowest-level one would be to have two arrays of strings, . One for the names, one for the associated passwords.
Also, two arrays (or one 2-D array) of floats for the balances.

You do the log in by asking for a string, and iterate through the name array to find a match with strcmp. If there's a match, you prompt the user for a password and do the same thing with the password array, looping until they get it right.

Then, you just keep the increment counter in memory, and refer to the array for the name of the person and their bank balances. This way, you don't have to write up a huge amount of redundant code, and you just manipulate the balances by referring to their locations in the arrays...

Make sense?

thanks, Drowzee
it makes sense all right. I'm trying to do it right now.

Cool.

Just to make sure I'm not confusing you:
Once you've got a valid userID, you only need to check the associated password, and loop the password prompt until it's entered correctly.

Also: Trying to get asterisks (*) entered instead of characters requires a lot more effort than it's worth to you right now.
It'd be better to just leave that kind of functionality alone.

As I didn't see any rules against double posting in this fashion, I thought it best to split this off to help seperate the topic, as my last one was far too heavily edited and almost unusable.

Yes, your current code is far too redundant. If you ever have code that is repeated with only minor changes like the name entered, there's a better, faster way to do it.

Let me introduce you to your friend and mine, 'Switch'.
Switch is, for an integer input (like a menu choice), a very handy tool.

int menu_sel;

//Get your menu selection somehow.

switch(menu_sel){
       case 0:  //menu selection for, I dunno... Deposits.
            Your deposit function;
       case 1: //Let's say, withdrawals.
            your withdraw function;
       case 2: //for whatever else you want. Just keep adding cases.
       default: //This  must always be at the end of the  cases. It catches anything that wasn't supposed to come through. So, if someone enters G, it'll be caught here.
        break; //It's always a good idea to use 'break' in the default. Just do it, it's good, safe coding.
} //end of the switch statement.

That'll help a little. More importantly, you'll need to make it so that you have one generic login, not five. You can do this a number of ways, but the lowest-level one would be to have two arrays of strings, . One for the names, one for the associated passwords.
Also, two arrays (or one 2-D array) of floats for the balances.

You do the log in by asking for a string, and iterate through the name array to find a match with strcmp. If there's a match, you prompt the user for a password and do the same thing with the password array, looping until they get it right.

Then, you just keep the increment counter in memory, and refer to the array for the name of the person and their bank balances. This way, you don't have to write up a huge amount of redundant code, and you just manipulate the balances by referring to their locations in the arrays...

Make sense?

Hi, i've tried the login part of your suggestion. But I don't know why I can't get get it to compile. this is my code. do you know what I did wrong?

#include <iostream>
#include <iomanip>
#include <string>
#include <stdlib.h>

using namespace std;

//Function Prototypes
string Signin (string, string);
void Menu ();
void ViewBalance ();
void Deposit ();
void Withdrawal ();
void Transfer ();


void main (void)
{
	string Username[] = {"Ohlone1","Ohlone2","Ohlone3","Ohlone4","Ohlone5"};
	string PWmain[] = {"Ohlone1pw", "Ohlone2pw", "Ohlone3pw", "Ohlone4pw", "Ohlone5pw"};
	
	cout << "WELCOME TO PROGRAMMING BANK!\n\n";
	cout << "~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~\n\n";

	Signin (*Username, *PWmain);
	Menu ();
}

string Signin (string &userID, string &PWuser)
{
	string ID, PW;
	cout << "Please enter your username: \n";
	cin.width(32);
	cin >> ID;
	
	for (int i =0; i < 5; i++)
	{ 
		if (strcmp(ID, userID[i]) == 0)
		{
			cout << "Please enter your password: \n";
			cin >> PW;
			for (int j =0; i < 5; i++)
			{
				if (strcmp(ID, PWuser[i])  ==0)
				{
					cout << "YOU'RE LOGGED IN!\n";
				}
			}
		}
	}
}

void Menu ()
{
	int choice; 

	cout << "\t1. View Your Balance.\n";
	cout << "\t2. Deposit.\n";
	cout << "\t3. Withdraw.\n";
	cout << "\t4. Transfer.\n";
	cout << "\t5. Exit.\n\n";
	cout << "Please enter your choice: \n";
	cin >> choice; 
	switch (choice)
	{
	case 1: 
		{
			//cout << "Your checking account has : " << << endl;
			//cout << "Your saving account has : " <<  << endl;
		}
	case 2:
		{
			//deposit
		}

	case 3:
		{
			//withdrawal
		}

	case 4:
		{
			//transfer
		}

	default:
		{
			cout << "Thank you for using this program.\n";
			break;
		}
	}
}

void ViewBalance ()
{
	//cout << "Your checking account has : " << << endl;
	//cout << "Your saving account has : " <<  << endl;
}

void Deposit ()
{
	int input;
	float deposit; 

	cout << "Which account would you like to deposit to?\n\n";
	cout << "1. Checking Account\n";
	cout << "2. Saving Account\n";
	cin  >> input;
	if (input = 1)
	{
		cout << "How much do you want to deposit to the Checking Account?\n\n";
		cin >> deposit;
		//What to do here?
	}
	if (input =2)
	{
		cout << "How much do you want to deposit to the Saving Account?\n";
		cin >> deposit;
		//What to do here?
	}
}

void Transfer ()
{
	int input;

	cout << "Would you like to transfer..\n\n";
	cout << "1. From CHECKING to SAVING\n";
	cout << "\nOR\n\n";
	cout << "2. From SAVING to CHECKING\n";
	cin >> input;
	if (input = 1)
	{
		// C_to_S ();
	}
	if (input = 2)
	{
		// S_to_C ();
	}
}

void Withdrawal ()
{
	int input;
	float withdraw;

	cout << "From which account would you like to withdraw?\n\n";
	cout << "1. Checking\n";
	cout << "2. Saving\n";
	cin >> input;
	if (input = 1)
	{
		cout << "How much would you like to withdraw from the Checking account?\n\n";
		cin >> withdraw;
		//what to do here? 
	}
	if (input = 2)
	{
		cout << "How much would you like to withdraw from the Saving account?\n";
		cin >> withdraw;
		//what to do here?
	}
}

did I do the switch thing right?

No, you don't need brackets inside the case statements.
I misled you on the way to accomplish this; C++ style strings don't play well with the strings.h library. The C++ style strings can actually be compared by the use of the ==, <=,>=,<, and > operators. So: here's code that works.
You can pass the string arrays by using

void functionname(string strarray[]);

and not worrying about the pointers. At least, for logging in.

You'll note I've modified the signin function to return an integer.
Sure, if you return a string, it will let you find the index of the associated balances, but why not just return the index and save yourself a step or two?


In C/C++, a function can only return one value. Anything that is passed to a function as an argument and changed (except for pointers) is unchanged outside of that function.
You need to worry about pointers to the arrays of floats in order to process transfers correctly, so you might as well use pointers for the simpler operations as well.

I've made a few other changes to enhance robustness for you, and made it a little more sensible in terms of the user interface. A few infinite loops let you keep running the program until you explicitly exit, which is always a good thing in this kind of program. You might consider adding in another case to allow the user to logout without exiting the program. That's a very easy (or, as we in the Elec.engineering department say, 'trivial'), addition, but not needed to complete the project.

#include <iostream>
#include <stdlib.h>

using namespace std;

//Function Prototypes
int Signin (string[], string[]);
void Menu (int ID);
void ViewBalance ();
void Deposit ();
void Withdrawal ();
void Transfer ();


void main (void)
{
	string Username[] = {"Ohlone1","Ohlone2","Ohlone3","Ohlone4","Ohlone5"};
	string PWmain[] = {"Ohlone1pw", "Ohlone2pw", "Ohlone3pw", "Ohlone4pw", "Ohlone5pw"};
	int userID;
		
	cout << "WELCOME TO PROGRAMMING BANK!\n\n";
	cout << "~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~\n\n";

	userID=Signin (Username, PWmain);	

	Menu (userID);
}

int Signin (string userID[], string PWuser[])
{
	string ID, PW;	
	
	while(1) //Infinite while loop.
	{
		cout << "Please enter your username: \n";
		cin.width(32);
		cin >> ID;	
		for (int i =0; i < 5; i++)
		{ 
			if(ID==userID[i]) 
			{
				for(;;) //Infinite for loop
				{
					cout<<"Please enter "<<userID[i]<<"'s Password."<<endl;
					cin >> PW;				
					if (PW==PWuser[i])
					{
						cout << "YOU'RE LOGGED IN!\n";
						return i;
					}
				}//end infinite for loop
			}
		}//end for loop cycling through User IDs.
		cout<<"Invalid Login, please try again."<<endl; // Entry was not any of the five known.
	}//end while loop
	return (-1);//error condition. Should be unreachable.
}

void Menu (int ID) 
{
	int choice; 

	while (1)
	{
		cout << "\t1. View Your Balance.\n";
		cout << "\t2. Deposit.\n";
		cout << "\t3. Withdraw.\n";
		cout << "\t4. Transfer.\n";
		cout << "\t5. Exit.\n\n";
		cout << "Please enter your choice: \n";

		cin >> choice; 
		
		switch (choice){
		case 1: 
			
				//cout << "Your checking account has : " << << endl;
				//cout << "Your saving account has : " <<  << endl;
			
		case 2:
			
				//deposit
			

		case 3:
			
				//withdrawal
			

		case 4:
			
				//transfer

		case 5:
			//exit. Better to have this explicit than rely on default. 
			//In this case, 6 will make the person exit the program. Not a good thing
			cout << "Thank you for using this program.\n";
			return; //Exits menu(), which then exits the program. 

		default:
			cout << "Invalid selection; please select another option.\n";
			break;
		}//end switch		
	}//end while loop. This lets you keep choosing until choice==5.
}//end menu()

What you need to do to make the program usable is add the savings and checking array(s), and modify menu to take pointers to the appropriate entries in the float arrays, and have your transaction functions call on those entries. The current use of 'userID' is to remind you to use it (it's the index of the username) to only send two individual entries from the float arrays.

Make sense?

thank you so much Drowzee! that makes so much sense. you're a lifesaver. I understand strings a little better now. OK, I'm giving my program another go. thanks again!

Karen

This assignment will exercise reference parameters, value parameters, and (most important) program decomposition.
This program will act as a bank. The general behavior will be:
• User walks into the bank
• User opens an account. This consists of:
o Asking the user for a name.
o Asking the user for an account balance.
o Asking the user for an interest rate. (OK, this is a very nice bank!)
• The user now gets to perform transactions until leaving the bank. These transactions are:
o Create an account. The user should supply his id , the initial amount of money deposited and choose to create either a saving or current account.
o Print a statement. This statement should say something like, "Hello (your name), your account balance is (amount) and your current interest rate is (rate)". You can make this more fancy if you want.
o Make a deposit. This should ask you for the amount, add it, and then print your balance (or, call the function which prints a statement)
o Make a withdrawal. Same as deposit. You could add some error checking to this routine as well.
o Financial planning. Ask the user for the current month and year. Ask for the retirement month and year. Using the number of years between and the current interest rate, project the amount the user will have upon retirement.
Hints:
• Declare a function for each of the operations. Declare more functions to support them if needed.
• No globals that aren't constants. Pass the account info around as a function argument.
• Try to use references variable whenever possible
• Feel free to embellish operations, especially the financial planning one. You can also add more operations if you are motivated.

#include <iostream>
#include <string>

using namespace std;
void create (string& name,long double& IC,long double& deposit);
void print (string name,long double IC,long double amount,long double rate);
void deposit (long double& balance,long double amount);
void withdrawal (long double& balance);

int main()
{
    int resp,ic,acc,transaction;
    long double deposit,rate,amount,balance;
    string name;
    int choose_acc (double& rate);
    
    system("cls");
    system("color 05");
    cout<< "     @           @  @ @ @ @  @         @ @ @    @ @ @   @       @  @ @ @ @     " <<endl; 
    cout<< "      @         @   @        @        @     @  @     @  @@     @@  @           " <<endl; 
    cout<< "       @   @   @    @ @ @    @        @        @     @  @ @   @ @  @ @ @       " <<endl;    
    cout<< "        @ @ @ @     @        @        @     @  @     @  @  @ @  @  @           " <<endl;    
    cout<< "         @   @      @ @ @ @  @ @ @ @   @ @ @    @ @ @   @   @   @  @ @ @ @     " <<endl;  
    
    cout<< "         @@@@@   @@@        @    @     @  @@@@     @    @   @  @   @           " <<endl;
    cout<< "           @    @   @      @ @   @@   @@  @   @   @ @   @@  @  @  @            " <<endl;
    cout<< "           @    @   @     @ @ @  @ @ @ @  @ -@   @ @ @  @ @ @  @ @             " <<endl; 
    cout<< "           @     @@@     @     @ @  @  @  @ @ @ @     @ @  @@  @   @           " <<endl;
    cout<<"\n\n\n";
    
    
    cout<<"Create an account?"<<endl
        <<"If YES press 1, If no press 2."<<endl;
    cin>>resp;
    
    if (resp==2)
        {  
        cout<<"Thank You for visiting!"<<endl;
        }
    else  
        {
         void  create (string&name,int& ic,long double& deposit,long double& rate);
         balance = amount;
         
    cout<<"                          Choose the Service:-          "<<endl;
    cout<<"                          ____________________________  "<<endl;
    cout<<"                          ' 1. Deposit               '  "<<endl;
    cout<<"                          ' 2. Withdrawal            '  "<<endl;
    cout<<"                          ' 3. Financial Planning    '  "<<endl;
    cout<<"                          ' 4. Checking Balance      '  "<<endl;
    cout<<"                          ' 5. Leaving               '  "<<endl;
    cout<<"                          ____________________________  "<<endl;
    
    }
    
    do 
    {
        switch (transaction)
        case 1:
             void deposit();
             break;
        case 2:
             void withdrawal();
             break;
        case 3:
             financial planning();
             break;
        case 4:
             checking balance();
             break;
        case 5:
             leaving();
             break;
        default:
             cout<<"ERROR!"<<endl;
             break;
   } 
   while (resp 2 == true)
        
        system ("PAUSE");
        return 0;
        }

void create (string& name,int& ic,long double& deposit,long double& rate);
{
     cout<<"Enter your IC no.:";
     cin>>ic;
     cout<<"Enter your Full Name:";
     cin>>name;
     cout<<"Deposit amount:";
     cin>>deposit;
     }
     
int choose_acc (double& rate);
{
         do
         {
                int acc;
                
                cout<<"Which acc to open?"<<endl
                    <<1. Saving Account<<endl
                    <<2. Current Account<<endl;
                    
                cin>>acc;
                if (acc==1)       rate = 0.05;
                else if (acc==2)  rate = 0.10;
                else              cout<<"Invalid no.!"<<endl;
                }
         while (acc==1)||(acc!=2)
         
void print (string name,long double IC,long double amount,long double rate);
{
     cout<<"Thank You for choosing AmBank!"<<endl
         <<"-------------------------------"<<endl
         <<"Name: "<<name<<endl
         <<"IC no: "<<ic<<endl
         <<"Amount in acc: "<<amount<<endl
         <<"Current rate: "<<rate<<endl
         <<"-------------------------------"<<endl;
         
         system("PAUSE");
         system ("cls");
}

void deposit (long double& balance,long double amount);
{
     
     cout<<"Amount to deposit: RM ";
     cin>>amount;
     balance = balance + amount;
}

void withdrawal (long double& balance);
{
     cout<<"Amount to withdraw: RM ";
     cin>>amount;
     
     if (amount<balance)   balance = balance - amount;
     else                  cout<<"not enough money!"<<endl;
}

void financial_planning (

I'am facing problem with this. I need help for this, i dono where goes wrong..
please help me!

This program was not run on my compiler i was used the turbo c compiler sir please send me the program according to this compiler

commented: It's C++... -1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.