Hello all,
Ive just started some coding at uni in c and have written one of my programs up, im down to one error which i can not seem to remove no matter what i do! This is very basic c i guess, probably a little error but its frustrationg me!
Code:
/*****************************************************************
Author: Michael R
Date: 22nd March 2005
Purpose: Assignment One - Validating Triangle Sizes
*****************************************************************/
#include <stdio.h>
int main ()
{
int firstside;
int secondside;
int thirdside;
printf("Enter the value of the first side of the triangle: ");
scanf("%d", &firstside);
printf("Enter the value of the second side of the triangle: ");
scanf("%d", &secondside);
printf("Enter the value of the third side of the triangle: ");
scanf("%d", &thirdside);
if { ((firstside == secondside) && (firstside == thirdside) && (secondside == thirdside))
printf("The first side inputed was %d\n", firstside);
printf("The second side inputed was %d\n", secondside);
printf("The third side inputed was %d\n", thirdside);
printf("As a result this is a equilateral triangle as all three sides are of equal length.");
}
else
if { ((firstside == secondside) || (firstside == thirdside) || (secondside == thirdside))
printf("The first side inputed was %d\n", firstside);
printf("The second side inputed was %d\n", secondside);
printf("The third side inputed was %d\n", thirdside);
printf("As a result this is a Isosceles triangle as two of the three sides are of equal length.");
}
else
if { ((firstside != secondside) && (firstside != thirdside) && (secondside != thirdside))
printf("The first side inputed was %d\n", firstside);
printf("The second side inputed was %d\n", secondside);
printf("The third side inputed was %d\n", thirdside);
printf("As a result this triangle has no sides of equal length and hence is a scalene triangle.");
}
else
printf("The first side inputed was %d\n", firstside);
printf("The second side inputed was %d\n", secondside);
printf("The third side inputed was %d\n", thirdside);
printf("The inputed sides do not create a valid triangle as the addition two sides are not greater than the third side ");
return(0);
}
The error i am recieving is on line 25 the first if statement I cant seem to remove it, this is the output i get when trying to compile.
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
g:\ict102\assessment1\test.c:
Error E2376 g:\ict102\assessment1\test.c 25: If statement missing ( in function main
*** 1 errors in Compile ***
If any1 could steer me in the right direction it would be a great help.
Cheers,
Michael