why wont my switch statement work

I finished writing my program, but as I debug it, my chosen choice goes to the default statement in my switch statement. I don't know why...
[code]
Put the code you need help with here.
[/#pragma once
#ifndef MENUBUILDER_H
#define MENUBUILDER_H
// preprocessor commands
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

class MenuBuilder
{
private:
double currBalance; //holds the balance

public:
MenuBuilder(void);// constructor
~MenuBuilder(void);//destructor
//methods
void buildMenu();
void processInput(int);

};
#endif
#include "MenuBuilder.h"



MenuBuilder::MenuBuilder(void)
{
currBalance= 2439.45;
}

// destructor
MenuBuilder::~MenuBuilder(void)
{
}

void MenuBuilder::buildMenu()
{
cout << "Welcome to the Devry Automated Teller Machine." << endl;
cout << "----------------------------------------------" << endl;
cout << "1. Check balance." << endl;
cout << "2. Make withdrawal." << endl;
cout << "3. Make deposit." << endl;
cout << "4. View account information." << endl;
cout << "5. View statement." << endl;
cout << "6. View bank information." << endl;
cout << "7. Exit." << endl;
cout << "Please make a selection from the menu." << endl;
}
// process user's choice
void MenuBuilder::processInput(int choice)
{
double currBalance = 2439.45;
double withdrawal = 0;
double deposit = 0;
double newBal = 0;
switch ( choice)
{
case '1':
cout << "Your account balance is " << currBalance << endl;
cout << endl;
break;

case '2':
cout << "How much would you like to withdraw from your account?" << endl;
cin >> withdrawal;
if (currBalance > withdrawal && withdrawal > 0)
{
newBal = currBalance - withdrawal;
cout << "Your new account balance is $ " << newBal << endl;
}
else
cout << "You made an invalid withdrawal";
cout << "Please make a selection from the above menu." << endl;
break;

case '3':
cout << "How much would you like to deposit to your account?" << endl;
cin >> deposit;
if (deposit > 0)
{
newBal = currBalance + deposit;
cout << "Your new account balance is $ " << newBal << endl;
cout << endl;
}
else
cout << "You made an invalid deposit";
cout << "Please make a selection from the above menu." << endl;
break;

case '4':
cout << "Name: Norman Brandon" << endl;
cout << "Account Number:1234554321 " << endl;
cout << endl;
cout << "Please make a selection from the above menu." << endl;
break;

case '5':
cout << " 01/01/11 - McDonald's - $6.27" << endl;
cout << "01/15/11 - Kwik Trip - $34.93" << endl;
cout << "2/28/11 - Target - $124.21" << endl;
cout << endl;
cout << "Please make a selection from the above menu." << endl;
break;

case '6':
cout << "Devry Bank, established 2011" << endl;
cout << "(123) 456-7890" << endl;
cout << "12345 1st. St." << endl;
cout << "Someplace, NJ. 12345" << endl;
cout << "Please make a selection from the above menu." << endl;
break;

case '7':
cout << "Thank you for chosing the Automated Teller Program." << endl;
cout << "Good-bye" << endl;
break;
default:
cout << "Invalid selection." << endl;
cout << endl;
cout << "Please make a selection from the above menu." << endl;
break;
}


}
#include "Menubuilder.h"
int main()
{
int choice = 0;
MenuBuilder transactions;
while (choice != 7)
{
transactions.buildMenu();
cin >> choice;
transactions.processInput(choice);
}
return 0;
}
closed account (E0p9LyTq)
The variable you are switching on (choice) is an int. Your case statement labels are char.

Not case '1':
Should be case 1:

PLEASE use code tags, it makes it easier to understand your code.

http://www.cplusplus.com/articles/jEywvCM9/

Hint: you can edit your post and add the code tags.
Topic archived. No new replies allowed.