
06-28-2007, 11:32 AM
|
| Novice | | Join Date: Jun 2007
Posts: 7
| |
Quote:
Originally Posted by siLenTz I am C++ programmer, and I think your code is in C right? It is little bit
messy. I think you should use switch() instead of using too many
elseif. Try this Code: switch(shape) {
case 't':
printf ("\nPlease enter the base of the triangle:");
scanf ("%f", &num);
printf ("\nPlease enter the height of the triangle:");
scanf ("%f", &num2);
total= 0.5 * num * num2;
printf ("area= 0.5 * %d * %d = %d", num, num2, total);
break;
case 'c':
// your code....
break;
default:
printf ("\n I do not know that letter that was inputed please try again!");
} Anyway, is it syntax error or logical error? If it is syntax error pleae
post your errors in here. if it is logical error then tell what happen. |
It tells me "error C2047: illegal default" |