Why isnt my code working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why isnt my code working?

I have made this code in c++ but it wont compile. I want to know how i can make the code run and what i did wrong. thanks for your help. https://code.sololearn.com/cZY5Czx1oQ92/?ref=app

30th Apr 2017, 2:37 PM
Jasper ten Hove
Jasper ten Hove - avatar
2 Answers
+ 1
There are multiply problems with your code: a) functions defined with a return type other than void have to return a value of corresponding type. That said, calculate_sum has to return either an int or signature changed to void calculate_sum. b) The operator + or * is not an int. Please use a char instead. c) comparison of input char with operator char: you need to quote the char with single quotes '*'. Double uoates would indicate a string and then you would have to use a comparator function. d) each call of multiply_or_sum will return a new Operator, so please only call it once in you main function. Please have a look at the fixed code attached. There is still a lot remaining to improve :) https://code.sololearn.com/cw978pOPc3x8/?ref=app
30th Apr 2017, 3:59 PM
Volker Milbrandt
Volker Milbrandt - avatar
0
Thanks! and yes i have got a lot to learn :-p
30th Apr 2017, 4:04 PM
Jasper ten Hove
Jasper ten Hove - avatar