新手!请各位大神看看错在哪?减和乘除无法运算
#include<iostream>using namespace std;
int main()
{
int a,b,c;
char i;
cin>>a>>b>>i;
if(i='+')
{
c=a+b;
cout<<c<<endl;}
if(i='-')
{
c=a-b;
cout<<c<<endl;
}
else if(i='*')
{
c=a*b;
cout<<c<<endl;
}
else if(i='/')
{
if(b==0)
cout<<"Divided by zero!"<<endl;
else if(b!=0)
c=a/b;
cout<<c<<endl;
}
else
cout<<"Invalid operator!"<<endl;
return 0;
}