vendredi 7 octobre 2016

error in getting the output due to comparision of char in c++

# include <iostream>
# include <string.h>
using namespace std;
int main()
{
int a,b;
cout<<"enter any two numbers\n";
cin>>a>>b;
char op[10];
char  p= 'add';
cout<<"enter the operation"<<endl;
cin>>op[10];
if(op[0]==p)
{
    cout<<a+b;
}
return 0;
}

it gets executed but does not show the output. I am a beginner. Please help me out.

Aucun commentaire:

Enregistrer un commentaire