0
what to do?
what should i done if i want to set int=+ , because c++ code grand dosn't accept it
8 ответов
+ 1
use char instead of int because + is a character
0
Could you please be more specific? What did you want to do with your code?
0
you can't use int as a variable name because it is a command
0
i want to build a calculator , so , can you explain it's basic code?
0
haji , to nmitoni mosbat ro be onvane esm bezari ,
yani mosbat y farmane esm nmishe
to mitoni vase mashin hesam az in code estefade koni:
#include "conio.h"
#include "iostream"
using namespace std;
int main(){
int x,y;
char element;
cout<<"2 adad vared konid"endl;
cin>>x>>y;
0
cout<<"amale morede nazar ra vared konid(+ - * /)"<<endl;
cin>>element;
switch (element){
case '+' : cout<<x+y<<endl;
break;
case '-' : cout<<x-y<<endl;
break;
case '/' : cout<<x/y<<endl;
break;
case '*' : cout<<x*y<<endl;
break;
default: cout>>"data vared shode sahih nist"
0
}
cin.get();
cin.get();
return 0;
}
- 1
kheili mamnoon