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

23rd Jan 2018, 3:45 AM
Andrew Minemann
Andrew Minemann - avatar
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.
23rd Jan 2018, 4:15 AM
Jacob Pembleton
Jacob Pembleton - avatar
+ 1
@Ace You might want to declare a and b.
23rd Jan 2018, 4:24 AM
Jacob Pembleton
Jacob Pembleton - avatar
0
@Ace you da real mvp
23rd Jan 2018, 4:26 AM
Andrew Minemann
Andrew Minemann - avatar
0
@ace the input of a and b isnt working i either get a blank output or a random number
23rd Jan 2018, 4:37 AM
Andrew Minemann
Andrew Minemann - avatar