0
Someone Help me on this assignment in c++
Basically I'm making a sales tax calculator you can say, search up "step function and discontinous function - algebra class" Look at examples 2 and its solution I want to make it like that, it will be simple for someone like an advanced c++ or intermediate level but for me its not. Look at how I did it but for some reason my teacher isnt accepting it since its not correct. https://code.sololearn.com/cB8oUETKz8H6/?ref=app If you have question let me know
29 Réponses
+ 2
Its not my explanation I got this from a website
+ 2
AFAIK
- Parentheses are not used for && conditions
- There is no use of else if / else 🙂
+ 2
Its already solved everyone thank you Martin Taylor
+ 1
Martin Taylor thanks much quick question why did you put a nested if statement? Would it work with just one if and multiple else if
0
Okay ill try to do that then
0
Martin Taylor sorry I was providing explanation in this block comment but this code is coming from visual studio
0
Martin Taylor alright i retyped it
https://code.sololearn.com/cB8oUETKz8H6/?ref=app
0
I just want it to be like under solution in #2
0
I split two primary examples on how to code it ignore the first one i took it out in the block comment
0
I wish i can show you a screenshot but thats how they want it to be
0
Look ill show you another example
.55 * 30 = 16.5
16.5 = 16 + .5
Tax = (.05 * 16) + .03 = .83
16.5 + .83 = 17.33
0
But I need if statements look at the link
0
Under example 2
0
Hey martin my bad
0
Wym? Sanjay Kamath I already solved the problem but uh?
0
boba Using else if makes the code more efficient. Suppose that there are 10 if statements, of which a single condition is to be checked. Using 'else if' causes the compiler to skip the rest if the first one is true. Of course, that doesn't matter here.
0
Hey used missed ';' in your code
at the end of both 'cout' commands and variable name is also incorrect in cin
You have written unitcost and declared variable name is unitscost.
0
Yes because it has few syntax errors as well as variable name at 11 line is not correct it misses 's' for 'unitscost'
So maybe because of this teacher is not accepting it, let me know if I am wrong.