0

what to do?

what should i done if i want to set int=+ , because c++ code grand dosn't accept it

16th Jun 2016, 3:51 PM
reza.sri
reza.sri - avatar
8 ответов
+ 1
use char instead of int because + is a character
17th Jun 2016, 5:01 AM
DJ Shiva & DJ Baba Shiv-Shekhar
DJ Shiva & DJ Baba Shiv-Shekhar - avatar
0
Could you please be more specific? What did you want to do with your code?
16th Jun 2016, 5:53 PM
LaserVision
0
you can't use int as a variable name because it is a command
16th Jun 2016, 6:35 PM
Klodian Lula
Klodian Lula - avatar
0
i want to build a calculator , so , can you explain it's basic code?
16th Jun 2016, 9:05 PM
reza.sri
reza.sri - avatar
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;
17th Jun 2016, 7:09 AM
shayan
shayan - avatar
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"
17th Jun 2016, 7:10 AM
shayan
shayan - avatar
0
} cin.get(); cin.get(); return 0; }
17th Jun 2016, 7:11 AM
shayan
shayan - avatar
- 1
kheili mamnoon
17th Jun 2016, 8:16 AM
reza.sri
reza.sri - avatar