[ create a new paste ] login | about

Link: http://codepad.org/HKWzJYCh    [ raw code | output | fork ]

C++, pasted on Mar 21:
#include <iostream>

using namespace std;

cosnt double DOLLAR_AMOUNT = 1.00F;
const double QUARTER_AMOUNT = 0.25F;
const double DIME_AMOUNT = 0.10F;
const double NICKEL_AMOUNT = 0.05F;
const double CENT_AMOUNT = 0.01F;

int main()

{
    double change; //make a double
    cout<<"Enter the amount (double): ";
    cin>>change;
    
    double dollars = change / DOLLAR_AMOUNT;
    change = change - dollars;
    
    double quarters  =  change / QUARTER_AMOUNT;
    change = change - quarters;
    
    double dimes = change / DIME_AMOUNT;
    change = change - dimes;
    
    double nickels = change / NICKEL_AMOUNT;
    change = change - nickels;
    
    double cents = change / CENT_AMOUNT;
    
    cout<<"quarters=  "<<quarters<<endl;
     
    cout<<"dimes=  "<<dimes<<endl;

    cout<<"nickels=  "<<nickels<<endl;
        
    cout<<  "cents=  "<<cents<<endl;
    
    system("pause");
    return 0;
}


Output:
1
2
Line 5: error: expected constructor, destructor, or type conversion before 'double'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: