Can any one tell me whats wrong with this program its giving me about ten
errors of the form
Compiling CALCULAT.C:
Error CALCULAT.C 30: Expression syntax in function calculation(double,double)
Error CALCULAT.C 31: Case statement missing : in function
calculation(double,double)
Error CALCULAT.C 33: Expression syntax in function calculation(double,double)
#include <stdio.h>
double a,b;
char sign,reply,Y,n;
double result;
double calculation(double x,double y);
main()
{
printf("Welcome to our calculator\n");
printf("Pliz enter the first number\n");
scanf("%d",&a);
printf("Pliz enter the sign\n");
scanf("%c",&sign);
printf("Enter the second number\n");
scanf("%d",&b);
result=calculation(a,b);
printf("%d %s $d=%d",a,sign,b,result);
printf("Do you require onother transection?enter y for yes and n for no\n");
scanf("%c",reply);
if(reply==Y)
printf("Enter onothe pair of numbers,and continue\n");
else
if(reply==n)
printf("Programme has been terminated\n");
return 0;
}
double calculation(double x, double y)
{
switch (sign) {
case + :
return(x+y);
break;
case * :
return(x*y);
break;
case - :
return(x-y);
break;
case / :
return(x/y);
break;
case % :
return(x%y);
break;
default :return 0; break;
}
}
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
Check outnew cars at Yahoo! Autos.
[Non-text portions of this message have been removed]