trying to get this code to work
Code:#include <iostream> #include <string> #include <fstream> #include <sstream> using namespace std; class Account { private: float balance; float deposit; float withdraw; public: Account(float balance, float deposit, float withdraw); void depositFunds(float balance); void withdrawFunds(float balance); float getBalance(float balance); }; /*Account::Account(float balance, float deposit, float withdraw) { balance = 2000; deposit = 0; withdraw = 0; }*/ void depositFunds(float balance) { float numb = 0; cout << "How much would you like to deposit: " << endl; cin >> numb; float dtotal = balance + numb; cout << "You have deposited "<<dtotal<<" dollars"<< endl; system ("PAUSE"); } void withdrawFunds(float balance) { float numb = 0; cout << "How much would you like to withdraw today: " << endl; cin >> numb; float wtotal = balance - numb; cout << "You have withdrawn "<<wtotal<<" dollars" << endl; system ("PAUSE"); } float getBalance(float balance) { balance = balance; return balance; } /*class Transaction { private: vector <string> transactionRecord; public: void addNewTransaction(string); };*/ void main() { int menu; int trigger = 0; float balance = 2000; Account myAccount = (balance); while(trigger==0){ cout << "1. Get a balance inquiry." << endl; cout << "2. Make a deposit." << endl; cout << "3. Make a withdrawal." << endl; cout << "4. Recent Transactions." << endl; cout << "5. Exit." << endl; cout << "what would you like to do?:"; cin >> menu; switch (menu){ case 1: //Current balance cout << myAccount.getBalance(balance); break; case 2://does the deposit cout << myAccount.depositFunds(balance); break; case 3://does the withdrawal cout << myAccount.withdrawFunds(balance); break; case 4://Recent Transactions //lalalal break; default:// exit out the loop cout << "Thank you for using our serivice"<<endl; cout << "Goodbye" << endl; system ("PAUSE"); trigger=1; } system ("cls"); } }
I'm geting 3 errors now.
1) Line 61: Can not convert float to account in function main()
Code:Account myAccount = (balance);
2) Line 77: Operator<< not implemented in type ostream for arguments of type void in function main()
3) Line 80: Operator << not implemented in type ostream for augments of type void in function main ()Code:cout << myAccount.depositFunds(balance);
Can anyone help me out in getting these 3 errors worked outCode:cout << myAccount.withdrawFunds(balance);
XI Wiki


