Hello all,
First off I would like to say that I am a novice programmer and am just starting to learn the language. This is also my first time on this board (which I hope to frequent quite often!) so if I am doing something wrong please let me know!
I am doing all of my programming in linux. That being said, I have done some very simple programs already and have ran into what seems to be a very simple problem on my current one.
I am trying to create a "greedy" program that counts the minimum number of coins used to create the amount that the user inputs. I keep getting "expected identifier or '('" errors when i try to compile in gcc using clang.
Here is my code and the error that I receive:
Code:
#include <stdio.h>
#include <math.h>
/**************
*Greedy
*Objective: To determine the least amount of coins used to represent the user's input
*The result will be the least possible amount of coins
***************/
int main(void);
{
int count = 0;
float change;
do
{
printf("O hai! How much change is owed?\n");
change = GetFloat();
}
while(change < 0);
return 0;
}
Through using clang I enabled my program to stop running and tell me where and when an error happens. This is what I get when I try to compile:
Code:
clang -ggdb3 -O0 -std=c99 -Wall -Werror greedy.c -lm -o greedy
greedy.c:12:1: error: expected identifier or '('
{
^
1 error generated.
I have looked at the different tutorials and even back at my past programs that have all started like that with no errors, and cannot seem to grasp what is happening. I have been stuck on this for 3 days now. Any guidance or help would be greatly appreciated!!!