my code not working.....why?

#include
using namespace std;
int main()

{
  int a,b,d;
  char c;

 cin>>a>>b;
 cin>>c;
 if(c=='+')
  {
 d=a+b;
  }
  else if(c=='-')
  {
    d=a-b;
   }
    else if(c=='*')
   {
     d=a*b;
     }
    else if(c=='/')
   {
          d=a/b;
    }
    cout<<d;
     return 0;

}

What error is your compiler reporting? Also in this version of your code ‘*’ is missing.

Please intend your code properly or use ideone/pastebin to link the code. It is very difficult to read code like this and help even if someone wants to. Also it would be better if you link the problem and what error are you getting so that one can find bug in your code.

First multiplication and division operator may result in double type value but as per your operation it will output only integer. So use double to store number and perform operation.

Second, take care of precision as mentioned in question.

i have re written the question…sorry for that earlier code…it says wrong answer…i dont understand.this code is for making calculator…problem code is URCALC

i have re written the question…sorry for that earlier code…it says wrong answer…i dont understand.this code is for making calculator…problem code is URCALC

thank you…but still it says wrong answer after i have changed it to double

Set the precision before printing to the console using std::setprecision to set the precision for atleast division operation.

Follw the below link for more information on that:

http://www.cplusplus.com/reference/iomanip/setprecision/

thank you!!