-4
/**************************************************
 * Greedy.c
 *
 * CS50x pset1
 * Daniel Riley
 *
 * A program that determines the minimum amount of
 * coins used for change owed
 *
 *
 **************************************************/
 #include <stdio.h>
 #include <cs50.h>
 #include <math.h>

 int main (void);
 {

 float change;
 int cents = round (change * 100);
 int coins = 0;

 do
     {
     printf("How much change is required? ");
     change = GetFloat();
     }
 while(change < 0);

 do
     {
     cents -= 25;
     coins ++;
     }
 while(cents >= 25);

 do
     {
     cents -= 10;
     coins ++;
     }
 while(cents >= 10);

 do
     {
     cents -= 5;
     coins ++;
     }
 while(cents >= 5);

 do
     {
     cents -= 1;
     coins ++;
     }
 while(cents >= 1);

 printf("%d\n", coins);
 return 0;
 }

I Get an error expected identifier '(' when compiling please help. It is line 17 the line after int main(void). As far as I can tell I have bracketed all functions correctly. The program has to ask a user for change and determine the least number of coins to use in giving change

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

3 Answers3

2

It's not the line after int main(void), it's the line after int main (void);. In other words, remove the ; in line 16.

melpomene
  • 84,125
  • 8
  • 85
  • 148
1
int main()
{
}

Miss out the ; in line 16

Michael Celey
  • 12,645
  • 6
  • 57
  • 62
sr01853
  • 6,043
  • 1
  • 19
  • 39
0

Remove the semicolon after main() function..

Raghu Srikanth Reddy
  • 2,703
  • 33
  • 29
  • 42