0

So this is the code I have right now for cash in problem set 1. I don't know whats wrong.

#include <stdio.h>
#include <cs50.h>        
#include <math.h>
int maid (void)
{
float c;
int  i;
i=0;

do
{
    c = get_float("Change: ");
}
while (c < 0);

//Round for each type of coin
c *=100;
i = round(c);
    //quarters
    while (i >= 25)
    {
        i++;
        i -= 25;
    }

    //dimes
    while (i >= 10)
    {
        i++;
        i -=25;
    }

    //nickels
    while (i >=5)
    {
        i++;
        i -= 25;
    }       

    //Penny
    while (i >=1)
    {
        i++;
        i -= 25;
    }


    //print coins
    printf("%i\n", i);
}

And this is the error that came up. enter image description here

PLEASE HELP ME! Thanks :)

1 Answer 1

1

By definition, the function named main does not require a return. From this doc

If the returned type is compatible with int and control reaches the terminating }, the value returned to the environment is the same as if executing return 0;

Check the spelling in the program here: int maid (void)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .