-
Code:
#include <iostream>
using namespace std;
int main()
{
//declare variables
double openingbalance =0;
double deposits =0;
double withdrawls =0;
double closingbalance =0;
//enter input items
cout << "Enter opening balance: ";
cin >> openingbalance;
cout << "Enter deposits: ";
cin >> deposits;
cout << "Enter amount withdrawn: ";
cin >> withdrawls;
//calcuate closingbalance
closingbalance= openingbalance + deposits - withdrawals;
//display output item
cout << "closingbalance: " << closingbalance << end1;
return 0;
} // end of main function
-
I am very new to C++ as you can tell any help would be nice
-
that looks pretty good. have you tested it?
-
Code:
cout << "closingbalance: " << closingbalance << end1;
Should be "endl", not "end1".
-
Thanks for your help, but I am still missing the closingbalance when I test it...
Code:
#include <iostream>
using namespace std;
int main()
{
//declare variables
double openingbalance =0;
double deposits =0;
double withdrawls =0;
double closingbalance =0;
//enter input items
cout << "Enter opening balance: ";
cin >> openingbalance;
cout << "Enter deposits: ";
cin >> deposits;
cout << "Enter amount withdrawn: ";
cin >> withdrawls;
//calcuate closingbalance
closingbalance = openingbalance + deposits - withdrawls;
//display output item
cout << "closingbalance: " << closingbalance << endl;
return 0;
} // end of main function
-
Are you having the problem with the console window disappearing when the program ends, so you don't see the last items printed?
http://faq.cprogramming.com/cgi-bin/...&id=1043284385