Stuck on pSet1 “Cash”

Im stuck on the cash problem. Feeling my brain is starting to synthesise with a lot more information. I get nervous when I start a problem out on my own. Nervous for typing on a keyboard in private. It’s the inner voice saying “you’ll never get this, you’ll never understand”.

Anyhow, Here I am in the problem:

#include <cs50.h>
#include <stdio.h>
#include <math.h>
int main (void)
{
    float input;
    
    int change;
    int noCoins;
    
//Prompt user for an amount of change
    do {
        input = get_float("How much change: ");
    }  
    while (input < 0);
    double cents = round(input * 100);
    printf("%0.2f\n", cents);

//Always use the largest coin possible
     noCoins = 0;
//Keep track of coins used
    change = input;
    printf("%i\n", change);
    
//Print final number of coins    
    

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s