#include<iostream.h>
int x,y;
int sum(int a,int b)
{
   int c;
   c = a+b;
   return (c);
}
Int sub (int a ,int b)
{
int c;
c = a-b ;
return (c);
}
int multi ( int a, int b )
{
int c ;
c = a*b;
return (c);
}
float div ( int a , int b)
{
float c;
c = a/b ;
return (c);
}
main()
{
cout<<"enter the value of x = ";
cin>>x;
cout<<"enter the value of y = ";
cin>>y;
cout<<"x + y  = "<< sum(x,y);
cout<<"\nx - y  = "<< sub(x,y);
cout<<"\nx * y  = "<< multi(x,y);
cout<<"\nx /y  = "<< div (x,y);
cin>>"\n";
}

Turbo C++ is showing declaration syntax error ? i can't find the error :(
and How do I use switch case in this code ?

In general if you're receiving an error, it's best practice to post the error. However, at a glance I see two potential issues, taking into account that Turbo C++ is an ancient and non-standard compiler:

  1. Case matters. On line 9 you use Int instead of int.
  2. div is in conflict with the standard library. It would be wise to use a different name.

From a logic standpoint, a/b likely won't give you what you want when a and b are both integers. Regardless of assigning the result to float, all precision is lost in the division step. You should at least cast one operand to floating point.

Thanks for your help.
Now i know the error , but i still don't know how to use switch case in this code :(

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.