ATM machine program help...
Nov 26, 2013 at 1:34am UTC
I need some help with my atm program. I don't remember how to inFile. I need to use that so that the users who log in are saved onto the program for future use. The program opens but when I select an option, it gives me an error saying "value2" is being used without being initialized. If there are anymore errors, could you please point them out.
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
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
cout << " /// /// //////// /// //////// //////// /// /// ////////\n" ;
cout << " /// /// /// /// /// /// /// ////////// ///\n" ;
cout << " /// // /// /////// /// /// /// /// /// // /// ////////\n" ;
cout << " ////////// /// /// /// /// /// /// /// ///\n" ;
cout << " /// /// //////// /////// //////// //////// /// /// ////////\n" ;
cout << " //////// ////////\n" ;
cout << " /// /// ///\n" ;
cout << " /// /// ///\n" ;
cout << " /// /// ///\n" ;
cout << " /// ////////\n" ;
cout << " ////////\n" ;
cout << " /// /// ///\n" ;
cout << " /// //////// ////////\n" ;
cout << " /// /// ///\n" ;
cout << " ////////\n" ;
cout << " /////// /// /// /// /// ///\n" ;
cout << " /// /// /// /// ///// /// /// ///\n" ;
cout << " //////// //////// /// ///// /////\n" ;
cout << " /// /// /// /// /// /// /// ///\n" ;
cout << " /////// /// /// /// /// /// ///\n" ;
int deposit(int , int );
int withdraw(int , int );
string Fname, Lname;
int choice=0;
int value1, value2, total;
do
{
cout << "\n\n" ;
cout << "\t\t 1. Deposit\n" ;
cout << "\t\t 2. Withdraw\n" ;
cout << "\t\t 3. Exit\n\n" ;
cout << "\t\t What would you like to do?: \n" ;
cin >> choice;
if (choice == 1)
{
cout << "How much money would you like to deposit?\n" ;
cin >> value1;
total = deposit (value1, value2);
}
if (choice == 2)
{
cout << "How much money would you like to withdraw?\n" ;
cin >> value2;
total = withdraw(value1,value2);
}
else if (choice == 3)
{
//User exits menu
}
else
{
cout << "Please enter a valid option\n" ;
}
if (choice >0 && choice <3)
{
cout << "You have $" << total << " left in your bank account...\n" ;
}
}while (choice != -1);
system("pause" );
return 0;
}
int deposit(int num1, int num2)
{
return (500 + num1);
}
int withdraw(int num1, int num2)
{
return (500 - num2);
}
Topic archived. No new replies allowed.