0
When I wrote this code it run successfully but the output was not right please some one help me.
5 ответов
0
https://code.sololearn.com/c4Pp6X9Ngq0e/?ref=app
0
Cin >> d;
You have to put your input in onother char variable to compare with chr d[] not put your input in d[].
#include <iostream>
using namespace std;
int main(){
    double a,b,c;
char d[5]={'+','-','*','/','%'};
char op;
   cout<<"Please enter the number \t";
    cin>>a;
    cout<<"what you want to do \t ";
    cin>>op;
    cout<<"Provide the 2nd Value \t";
    cin>>b;
    if(op == d[0])
    c=a+b;
    if(op == d[1])
    c=a-b;
    if(op == d[2])
    c=a*b;
    if(op == d[3])
    c=a/b;
    if(op == d[4])
    c=a/b*100;
    cout<<endl<<"Your result is: "<<c;
    
    return 0;
}
0
Thanks man I got the idea now
0
U r welcome.



