Skip to content

Instantly share code, notes, and snippets.

@nathanchere
Forked from JamesCalleja/greedy.c
Last active August 29, 2015 14:26
Show Gist options
  • Save nathanchere/aa89167bff015f627af2 to your computer and use it in GitHub Desktop.
Save nathanchere/aa89167bff015f627af2 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <float.h>
// declare global variables
float qrt;
float dim;
float nik;
float pen;
float chg;
//declare functions
float GetChange(float i);
float MakeChange(float j);
//main application logic
int main()
{
qrt = 0.25;
dim = 0.10;
nik = 0.05;
pen = 0.01;
chg = 0;
chg = GetChange(chg);
MakeChange(chg);
}
//define functions
float GetChange(float i)
{
do
{
printf ("Enter the amount of change owed:\n" );
scanf ("%d", &i);
//printf ("You entered: %i\n", i);
if (i < 0 )
{
printf ("Please enter a positive number\n");
}
}while (i < 0);
return i;
}
float MakeChange(float j)
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment