I have made a program for basic calculator using if and else blocks, I have tested it many time and am getting the correct answer each time. Then am I not getting full marks for that?
#include
using namespace std;
int main()
{
char a;
cin>>a;
if(a==’’)
{
float y,z,result;
cin>>y>>z;
result=yz;
cout<<result;
}
else if(a==’+’)
{
float y,z,result;
cin>>y>>z;
result=y+z;
cout<<result;
}
else if(a==’-’)
{
float y,z,result;
cin>>y>>z;
result=y-z;
cout<<result;
}
else if(a==’/’)
{
float y,z,result;
cin>>y>>z;
result=y/z;
cout<<result;
}
else if(a==’%’)
{
int y,z,result;
cin>>y>>z;
result=y%z;
cout<<result;
}
else if(a==‘x’)
{}
else if(a==‘X’)
{}
else{
cout<<“Invalid Operation.Try Again”;
}
return 0;
}