+ 10
Can we assign "+,-,*,/" as a variable to take input for an basic calculator in c++
5 ответов
+ 5
It's not allowed to use spesial symbol like+- etc
+ 4
We cannot take an operator as a name for a variable... variable names can only start with an alphabet or an underscore and won't have an operator in them...
To create a basic calculator something like this can be done..
int main(){
int x,y,sum;
cout << "enter two nos. for addition:"
cin >> x;
cin >>y;
sum=x+y;
cout <<sum;
}
and the remaining operations can be done similarly
+ 1
we can no assign "+,-,*,/" as variable name.
0
variables always start with some alphabets (a - z)