I have done CS50 for about 2 weeks now, and I keep on getting stuck at this part of the code. (Greedy Problem set)
#include <stdio.h>
#include <cs50.h>
#include <math.h>
#define Q 25;
#define D 10;
#define N 5;
int main(void)
{
do
{
printf ("How much change do you owe?\n");
printf ("I will count the coins it takes: ");
float Change = GetFloat();
}
while(Change < 0);
}
Whenever I test run this code in the compiler, it keeps on telling me
greedy.c:16:11: error: unused variable 'Change' [-Werror,-Wunused-variable]
float Change = GetFloat();
^
greedy.c:18:7: error: use of undeclared identifier 'Change'
while(Change < 0);
I don't know why this happens. For all other programs I see that do this, it runs perfectly. However, when I type, the compiler seperates my variable from the outside.