Now with that said I think what I really want to know is if the way I am writing this code is efficient and correct. I am more used to using Eclipse for Java so I had the hardest time simply getting myMenu to work correctly and appear with all the input options but I worry that my code is flawed since I am such an inexperienced C++ writer.
#include <iostream>
using namespace std;
void welcomeScreen()
{
cout << "===============================================" << endl;
cout << ""<< endl;
cout << "Welcome to My Bank ATM" << endl;
cout << "" << endl;
cout << "===============================================" << endl;
cout << "Can I help you today?"<< endl;
cout << "" << endl;
system ("pause");
}
char myMenu()
{
cout << "Enter # 1 for Deposits" << endl;
cout << "Enter # 2 for Withdrawals" << endl;
cout << "Enter # 3 for Transfers" << endl;
cout << "Enter # 4 to View Balance" << endl;
cout << "Enter # 5 to Exit" << endl;
cout << "" << endl;
cout << "Enter a number to continue" << endl;
int xin;;
cin >> xin;
system("CLS");
if (xin == 1)
{
cout << "Entering Deposits section\n" << endl;
return myMenu();
}
else if (xin == 2)
{
cout << "Entering Withdrawals section\n" << endl;
return myMenu();
}
else if (xin == 3)
{
cout << "Entering Transfers section\n" << endl;
return myMenu();
}
else if (xin == 4)
{
cout<< "Entering Balance section\n" << endl;
return myMenu();
}
else if (xin == 5)
{
cout << "Exiting from the program\n" << endl;
return myMenu();
}
else
{
cout << "Invalid Entry!\n" << endl;
return myMenu();
}
system ("pause");
}
int main()
{
myMenu();
welcomeScreen();
return 0;
}
I truly hope someone will be able to help me. I look forward to working with you guys and eventually throwing back my own information to help others!
Sorry for the mistake in my [code] tag...I don't know how to edit posts unfortunately
This post has been edited by jimblumberg: 14 June 2012 - 08:38 PM
Reason for edit:: Fixed Code tags.

New Topic/Question
Reply



MultiQuote



|