//So I'm writing this program that converts change into smaller denominations.
//For example .97 would be 3 quarters, 2 dimes, 0 nickels, with 2 remaining.
//The program compiles and runs but it's not the completely correct output. Can //anyone help.
//Converts change into small denominations.
#include "stdafx.h"
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int quarters = .25;
int dimes = .10;
int nickels = .05;
int pennies = .01;
double usersMoney;
cout << "Enter a decimal for change amount";
cin >> usersMoney;
int amount = (usersMoney / .25);
int remaining = usersMoney - (amount * .25);
int amount1 = (remaining / .10);
int remaining1 = remaining - (amount1 * .10);
int amount2 = (remaining1 / .05);
int remaining2 = remaining1 - (amount2 * .05);
cout << usersMoney << " converted is: " << amount << " quarters " << amount1 << " dimes " << amount2 << " nickels. With " << remaining2 << " remaining." << endl;
getch();
return 0;
}
LacyMacy 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.