0
Help
ive been trying to get a project of mine to take in word commands (like addition, subtraction, multiplication, division) but the problem is the function doesnt carry through can someone help me get it to work? my base idea was that there is a function that uses 2 inputs and adds, subtracts, or multiplies them etc. but the problem is that it seems to ignore ny function. i started with addition as a test. https://code.sololearn.com/cCr2ddNhwT88/?ref=app
6 Answers
+ 2
Your problem appears to be in this line:
if(cin==addition){
First, you canât use cin like this. It has to be:
char var[100];
cin >> var;
if (var == addition) {
Second, addition is an array of 100 characters that is not initialized. This means they cannot be equal, and since var is being compared to the entire array, it has to be 100 characters.
+ 1
@Ace
You might want to declare a and b.
0
@Ace you da real mvp
0
@ace the input of a and b isnt working i either get a blank output or a random number