Okay I'm on a assignment and I was hoping if anyone could look at it and tell me if it's good or anything needs to be change. I know the program isn't fully completed yet, but i just need anyone to double-check it for me. [:
#include <iostream>
using namespace std;
int main ()
{
double balance = 0.0;
double check = 0.0;
double deposit = 0.0;
double charge = 0.0;
cout << "What is your balance? ";
cin >> balance;
system("CLS")
int selection;
cout << Please select one of the following opinions.\n
<< "1. Check\n"
<< "2. Deposit\n"
<< "3. Charge\n"
<< "4. Quit\n"
<< "Selection: ";
cin >> selection;
return 0;
without know what the purpose of this program is or the eventual requirements I cannot make relevant reccomendations.
However, the skeleton you provided will work, though I might suggest not removing the balance you just entered from the screen as the user may want to know it before making a selection.
And one final thought: A more descriptive cout of the selection menu will help a user to more effectively use your program. What is the selection for?
Other suggestions:
cout << " please select... " [don't for get your quotes!]
I might declare int selection with your other variables, even if it is before you use it. This make the program easier to read, in my somewhat untested opinion...
AQnd lastly I would include either cin.get() or system("Pause") at the end of the program just before return 0;
to allow you to actually see the output before the console closes. Cin.get() is good if you expect the code to need to go between Linux and windows or others.