1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#include <iostream>
#include <iomanip>
using namespace std;
int input_coins (int,int,int,int);
void Totamt( double&,double&,double&,double&,double);
void display(double);
int main()
{
int quaters,dimes,nickles,pennies;
double quaters1,dimes1,nickles1,pennies1,total;
input_coins(quaters,dimes,nickles,pennies);
Totamt(quaters1,dimes1,nickles1,pennies1,total);
display (total);
return 0;
}
int input_coins(int quaters,int dimes,int nickles,int pennies)
{
cout<<"Please enter total quaters"<<endl;
cin>>quaters;
cout<<"Please enter total dimes"<<endl;
cin>>dimes;
cout<<"Please enter total nickles"<<endl;
cin>>nickles;
cout<<"Please enter total pennies"<<endl;
cin>>pennies;
return quaters,dimes,nickles,pennies;
}
void Totamt(double & quaters, double & dimes, double & nickles, double & pennies,double total)
{
total=(quaters*.25)+(dimes*.10)+(nickles*05)+(pennies*.01);
}
void display(double total)
{
cout<<setprecision(10)<<setw(8)<<endl;
cout<<"Your total amount in your piggybank is: "<<total<<endl;
}
|