Help Please

Hello everyone, I am new here and new to c++ programming. Taking a class and working on a project. I am stuck as my program doesn't switch to my function calls. Can someone tell me what I am doing wrong. I still have more to write, but I am stuck here. The program is an ATM program that asks the user what transaction they wish to perform. Any help would be greatly appreciated. Here is what I have so far


#include<iostream>
#include<iomanip>
#include<fstream>
#include<string>
using namespace std;
struct Name {
string lastName;
string firstName;
};
struct accountInfo {
int accountNumber;
double accountBalance;
int PIN;
};
void showMenu();
void withdraw(double cashout);
void deposit(double cashin);
void balance(double totalcash);
void transfer(double cashtransfer);

int main()
{
Name last;
Name first;
int acctNumb = 753951;
int PIN = 7895;
char choice;
bool Quit_Program = false;
double accountBalance = 50.000;

cout << "\nWelcome to the International ID10T Bank of America" << endl;
cout << "\nPlease enter your Bank account number and PIN" << endl;
cin >> acctNumb;
cin >> PIN;
if (acctNumb == 753951 && PIN == 7895)
{
cout << "\t****************************" << endl;
cout << "\t Welcome David Smith   " << endl;
cout << "\t****************************" << endl;
do {
showMenu();
cin >> choice;
switch (choice)
{
case 'q':
case 'Q':

break;
case 'b':
case 'B':
void balance(double totalcash);

break;
case 'd':
case 'D':
void deposit(double cashin);

break;
case 'w':
case 'W':
void withdraw(double cashout);

break;
case 't':
case 'T':
void transfer(double cashtransfer);
break;
default:
cout << "Error: '" << choice << "' is an invalid selection -  try again" << endl << endl;
break;
}
} while (Quit_Program);
}
else
{
cout << "\nAccount number or PIN not recognized, please reenter." << endl;
}

return 0;
}
//Client's options to decide what transaction he wants to go with.
void showMenu()
{
cout << endl << endl;
cout << "Select one of the following transactions:" << endl;
cout << "\t****************************" << endl;
cout << "\t    List of Choices         " << endl;
cout << "\t****************************" << endl;
cout << "\t     W -- Withdrawal" << endl;
cout << "\t     D -- Deposit" << endl;
cout << "\t     B -- Balance Inquiry" << endl;
cout << "\t     X -- Delete Account" << endl;
cout << "\t     Q -- Quit" << endl;
cout << endl << "\tEnter your selection: ";
return;
}
void withdraw()
{
cout << endl << endl;
cout << "\t****************************" << endl;
cout << "\t   Withdrawl Amount         " << endl;
cout << "\t****************************" << endl;
cout << "\t Please select amount the amount of cash you wish to withdraw" << endl;
return;
}
void deposit()
{
cout << endl << endl;
cout << "\t****************************" << endl;
cout << "\t   Deposit Amount         " << endl;
cout << "\t****************************" << endl;
cout << "\t Please select the amount of cash you wish to deposit" << endl;

return;
}
void balance()
{
double accountBalance = 50000;
cout << "\t****************************" << endl;
cout << "\t  David's Smith Balance       " << endl;
cout << "\t****************************" << endl;
cout << setw(25) << accountBalance << endl;
}
void transferAccount()
{
cout << "\t****************************" << endl;
cout << "\t   Transfer Amount        " << endl;
cout << "\t****************************" << endl;
cout << setw(25) << "\nPlease select amount you wish to transfer" << endl;
return;
}
Please use code blocks when displaying code on the forums.

You are not calling your functions correctly. You are attempting to redeclare them inside main.
http://www.cplusplus.com/doc/tutorial/functions/

1
2
3
4
5
6
void Showmenu();
//You declared it like this.
void Showmenu();
//You call it in main like this, Which is incorrect since it is a declaration.
Showmenu();
//This is how you would call it in main. 

Last edited on
Thank you, I'm sorry about the format issue. Next time, I will fix that.
Topic archived. No new replies allowed.