::SIGH:: Functions=Frustration

• 07-08-2003
flatline911
::SIGH:: Functions=Frustration
I can't get this acceptinput function to work for the life of me, what am I doing wrong, all Ii get is error after error.

Thanks
John

Code:

``` #include <iostream.h> #include <iomanip.h>               float current_bank_balance, total_amount_checks_written;             float total_amount_deposits;             float ending_balance, monthly_charges, dividends, final_balance;             float total_monthly_charges = 0, total_dividends = 0;             int loopcount;             int main (  ) {             //Print out the heading line             cout << "\t\t\t\t\t\tFirst Bank of YourName\n\n";                         //Start the loop             for(loopcount=1; loopcount < 4; loopcount++)             {             // Bring the input information in                                                     acceptinput ();                                                     //compute             ending_balance = current_bank_balance + total_amount_deposits - total_amount_checks_written;             if(ending_balance < 0)             {                         monthly_charges = 33;                         dividends = 0;             }             if(ending_balance >= 0 && ending_balance < 500)                         monthly_charges = 25;             if(ending_balance >= 500)                         monthly_charges = 8;                         if(ending_balance >= 0 && ending_balance <= 500)                         dividends = 0.02 * ending_balance;             if(ending_balance > 500)                         dividends = 0.035 * ending_balance;             final_balance = ending_balance - monthly_charges + dividends;                         //accumulate totals             total_monthly_charges = total_monthly_charges + monthly_charges;             total_dividends = total_dividends + dividends;                         //print a detail line             cout.setf(ios::fixed);             cout << setprecision(2) << "\n\t\t\t\t\tBeginning Balance \$ " << current_bank_balance << "\n";             cout << "\t\t\t\t\tDeposits          + " << total_amount_deposits << "\n";             cout << "\t\t\t\t\tLess Checks      - " << total_amount_checks_written << "\n";             cout << "\t\t\t\t\tEnding Balance    \$ " << ending_balance << "\n";             cout << "\t\t\t\t\tMonthly Charges  - " << monthly_charges << "\n";             cout << "\t\t\t\t\tDividend          + " << dividends << "\n";             cout << "\t\t\t\t\tFinal Balance    \$ " << final_balance << "\n\n";             }                                  //end loop                         //Print Totals             cout << "    Totals:\n";             cout << "\t\tMonthly Charges: \$" << total_monthly_charges << "\n";             cout << "\t\tDividends:      \$" << total_dividends;                         return 0; } void acceptinput() { cout << "Enter Beginning Balance:  ";             cin >> current_bank_balance;             cout << "Enter total amount of deposits: ";             cin >> total_amount_deposits;             cout << "Enter total amount of checks: ";             cin >> total_amount_checks_written;             }```
• 07-08-2003
Perspective
i dont know if this will fix your problem but being that this is the c++ forum ill suggest the following...

use: #include <iostream>
not: #include <iostream.h>

add: using namespace std; // after include statments.
• 07-08-2003
flatline911
Thanks Salem, it worked here is my result. Tell me what you think.

btw Salem, I PM'ed you, I don't know if you check them or not.

John

Code:

``` #include <iostream.h> #include <iomanip.h>               float current_bank_balance, total_amount_checks_written;             float total_amount_deposits;             float ending_balance, monthly_charges, dividends, final_balance;             float total_monthly_charges = 0, total_dividends = 0;             int loopcount;                                 void acceptinput()//Begin Accept Input Function { cout << "Enter Beginning Balance:  ";             cin >> current_bank_balance;             cout << "Enter total amount of deposits: ";             cin >> total_amount_deposits;             cout << "Enter total amount of checks: ";             cin >> total_amount_checks_written;             }//End Accept Input Function void EndBalance()    //Begin End Balance Function {  ending_balance = current_bank_balance + total_amount_deposits - total_amount_checks_written;             if(ending_balance < 0)             {                         monthly_charges = 33;                         dividends = 0;             }             if(ending_balance >= 0 && ending_balance < 500)                         monthly_charges = 25;             if(ending_balance >= 500)                         monthly_charges = 8;                         if(ending_balance >= 0 && ending_balance <= 500)                         dividends = 0.02 * ending_balance;             if(ending_balance > 500)                         dividends = 0.035 * ending_balance; }//End End Balance Function void finalbalance() //Begin Final Balance Function {             final_balance = ending_balance - monthly_charges + dividends; }//End Final Balance Function             void Accumulators()//Begin Accumulators Function { total_monthly_charges = total_monthly_charges + monthly_charges; total_dividends = total_dividends + dividends; }//End Accumulators Function void Printstatement()  //Begin Print Statement Function {             cout.setf(ios::fixed);             cout << setprecision(2) << "\n\t\t\t\t\tBeginning Balance \$ " << current_bank_balance << "\n";             cout << "\t\t\t\t\tDeposits          + " << total_amount_deposits << "\n";             cout << "\t\t\t\t\tLess Checks      - " << total_amount_checks_written << "\n";             cout << "\t\t\t\t\tEnding Balance    \$ " << ending_balance << "\n";             cout << "\t\t\t\t\tMonthly Charges  - " << monthly_charges << "\n";             cout << "\t\t\t\t\tDividend          + " << dividends << "\n";             cout << "\t\t\t\t\tFinal Balance    \$ " << final_balance << "\n\n"; }//End Print Statement Function void printtotals() //Begin Print Totals Function {  cout << "    Totals:\n";             cout << "\t\tMonthly Charges: \$" << total_monthly_charges << "\n";             cout << "\t\tDividends:      \$" << total_dividends; }// End Print Totals Function int main (  ) {             //Print out the heading line             cout << "\t\t\t\t\t\tFirst Bank of Charlie Elings\n\n";                         //Start the loop             for(loopcount=1; loopcount < 4; loopcount++)             {             // Bring the input information in                                              acceptinput ();                                                  //compute                                  EndBalance();                     finalbalance();                         //accumulate totals                         Accumulators ();                                //print a detail line                     Printstatement();                       }                                  //end loop                                  //Print Totals           printtotals();                         return 0; }```