View Single Post
  #3 (permalink)  
Old 06-28-2007, 11:32 AM
hnkplaya hnkplaya is offline
Novice
Join Date: Jun 2007
Posts: 7
iTrader: (0)
hnkplaya is on a distinguished road
Quote:
Originally Posted by siLenTz View Post
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"

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote