the immediate problem is that you don't delcare you functions before main, and then you have semicolons after the function in the definitions...
You need your code to look more like the following...
CODE
//This is a declaration... note the semi-colon.
int myfunc(int arg1, int arg2);
int main()
{
//you need the declaration to be before any use of the function...
int i = myfunc(1, 2);
return i;
}
//This is the definition, note the lack of a semi colon.
int myfunc(int arg1, int arg2)
{
return arg1 * arg2;
}
Once you fix that you will run into a lot more errors....
you open brackets { and never close them (thus the unexpectend end of file).
an if statement should look like
if (AngleA==90 ||AngleB == 90 ||AngleC==90) {rightangle = 1;}where '==' means 'is equal to' and '||' means 'or'. The brackets are not needed if you only want to execute one statement, but they make you life much more managable if you get into the habbit of always using them.
the line
rightangle=rightangle; has no effect in this code... I assume you wan't something like
rightangle=1; which would be like saying that
rightangle=true; as in C 0 is false and none zero is (for lack of a better name) true. You have 4 items names rightangle... a global varable, a variable local to main, a function, and a variable local to that function. You only need one. You can do without the global variable as they are an evil trick of the devil sent to cause bugs that make you pull out your hair. The function should be named discriptively like
isRightTriangle() so you know what it does.
here is that one function re-written:
CODE
int isRightTriangle(int AngleA, int AngleB, int AngleC)
{
int isRight = 0;
//Might as well do it right...
if (AngleA + AngleB + AngleC == 180)
{
if (AngleA==90 || AngleB==90 || AngleC==90)
{
isRight = 1;
}
}
return isRight;
}
This function will return a 1 if the three angles can discribe a euclidean right triangle, else it will return a 0;
This post has been edited by NickDMax: 15 Mar, 2007 - 08:18 PM