Link to home
Start Free TrialLog in
Avatar of mmorse0971
mmorse0971

asked on

when running program I receive an error "runtime check failure #3

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
      cout.precision(2);
      cout.setf(ios::fixed);
      //****INITIALIZE****
      int            Shares;                                          
                double      MarketPrice;                                    
                double      CommissionFee = 0.02;            
      double      CommissionMinimumFee = 32.95;      
      double      MarketValue      = MarketPrice * Shares;                  
                double      CommissionPaid = CommissionFee * Shares;      
      
      //****PROGRAM TITLE*****
      cout << "\t\t\t**********STOCK PROGRAM**********\n\n"<<endl;
      
      //****USER INPUT*****                              
      cout << "Please enter amount of shares:  "<<endl;
      cin >> Shares;

      cout << "Please enter price per share:   "<<endl;
      cin >> MarketPrice;
      
      //****DISPLAY*****
      cout << "Shares:\t\t\t " << Shares << endl;
      cout << "Market Price Per Share:\t $" << MarketPrice << endl;
      cout << "Commission Fee:\t\t $" << CommissionFee << endl;
      cout << "Commission Minimum Fee:\t $" <<CommissionMinimumFee << endl;

      cout<< "\n\nMarket Value:\t\t $" << MarketValue << endl;
      
      //****CONDITIONAL STATEMENT*****
      if (CommissionPaid < CommissionMinimumFee) {
      
            cout << "Commission Paid:\t$" <<CommissionMinimumFee << endl;
      }
      else if (CommissionPaid > CommissionMinimumFee) {
            
            cout <<"Commission Paid:\t$" <<CommissionPaid<< endl;
            
      }

cin.ignore();
cin.ignore();
//*****END PROGRAM*****
}
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial