hi there, it's been a long time since i posted a thread here. By the way, i'm having a hard time dealing with this code.

Actually it's a menu driven and function-oriented program and when i compiled it, the error message is expression syntax in function main

Here's my code

# include <stdio.h>
# include <conio.h>

void display()
{
puts("OPERATOR MENU");
puts("*************");
puts("[+] Addition");
puts("[-] Subtraction");
puts("[*] Multiplication");
puts("[/] Unary Divsion");
puts("[%] Modulus Division");
}

void input_no()
{
int A,B;
printf("\n");
printf("\t Enter first number:");
scanf("%d",&A);
printf("\n\t Enter second number:");
scanf("%d",&B);
}

char input_optr()
{
char optr;
printf("\n\t Enter an operator:");
scanf("%c",&optr);
return(optr);
}

[B]int operation(int x,int y);[/B]//error
int evaluate();
char optr;
int result;
main()
{
clrscr();
display();
input_no();
input_optr();
while(optr!='+'||optr!='-'||optr!='*'||optr!='/'||optr!='%')
{
puts("Invalid operator!");
return input_optr();
}[B]
int  operation(int x,int y);[/B]//error
evaluate();
getch();
return 0;
}

[B]int operation(int x,int y)[/B]//error
{
if(optr=='+')
result=x+y;
else if (optr=='-')
result=x-y;
else if(optr=='*')
result=x*y;
else if(optr=='/')
result=x/y;
else if(optr=='%')
result=x%y;
}

int evaluate()
{
int ones, tens, hundreds;
if(result>1000||result<0)
{puts("Invalid input");
return main();}
else
{
hundreds=((result/100)%10)*100;
tens=((result/10)%10)*100;
ones=((result/1)%10)*100;
{
if(hundreds==100)
printf("C");
else if(hundreds==200)
printf("CC");
else if(hundreds==300)
printf("CCC");
else if(hundreds==400)
printf("CD");
else if(hundreds==500)
printf("D");
else if(hundreds==600)
printf("DC");
else if(hundreds==700)
printf("DCC");
else if(hundreds==800)
printf("DCCC");
else
printf("CM");
}
{
if(tens==10)
printf("X");
else if(tens==20)
printf("XX");
else if(tens==30)
printf("XXX");
else if(tens==40)
printf("XL");
else if(tens==50)
printf("L");
else if(tens==60)
printf("LX");
else if(tens==70)
printf("LXX");
else if(tens==80)
printf("LXXX");
else
printf("XC");
}
{
if(ones==1)
printf("I");
else if(ones==2)
printf("II");
else if(ones==3)
printf("III");
else if(ones==4)
printf("IV");
else if(ones==5)
printf("V");
else if(ones==6)
printf("VI");
else if(ones==7)
printf("VII");
else if(ones==8)
printf("VIII");
else
printf("IX");
}

printf("is the ROMAN NUMERAL conversion of %d", result);
}
}

I know its kinda long but your help will truly be appreciated.
thanks and GOD BLESS!

1) Format your code so we can easily follow it
2) Never paraphrase an error -- give it to us exactly!
3) Out of 145 lines, which one has the error?
4) main() is an int function -- see this
5) Why are you using conio.h. There is nothing in that header you really need. And it's not Standard C.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.