I am to write a utility that converts dollars to coins. A simple program that must have the following:
* Multiple outputs to the screen
* At least one input
* The use of integers and strings
* Looking or repetition with Do..While, If..Else
* Must have some output text to show correct value of coins that would be converted from the dollars.
* Code must include comments explaining your reason for the code section or what the code is doing
* Code must compile
* Whole dollars only. If value is less than 1 or 0, the program should break or exit.
Source code (.cpp file)
<iostream>
using std::cin;
using std::cout;
using std::fixed;
using std::end1;
#include <iomanip> // parameterized stream manipulators
using std::setprecision; // set numeric output precision
void ConvertToCoins(double);
int main ( )
{
double amount;
while(true)
{
//Add your code here to ask the user for the amount and input the amount.
if(amount < 0) break;
ConvertToCoins(amount);
}
return 0;
}
void ConvertToCoins (double amt)
{
static int quarters = 0;
static int dimes = 0;
static int nickles = 0;
static int pennies = 0;
Comments
Leave a comment