0
Code giving wrong answers : 30 * 10 = 150 and 10 * 10 = - 350 please help >.<
First c++ program ive written by myself to estimate net pay for paychecks. https://code.sololearn.com/cK8ar3L0pSK9/?ref=app
3 Antworten
+ 5
Macathain , please include programming language in tags when you post a question here. Thanks!
+ 1
h = hr - 40;
if I worked 20 hours
h = 20 - 40 = -20
So the number of hours that are worked become negative and then the next equations als get a negative value.
It probably should be
h = 40 - hr;
+ 1
So h = 40 - hr; didnt work.. i found out that, as you said, it was the h calculation that was messin it up. but it was because i had defined it outside of the func. So i changed the value to 0 and just redefined it inside the func. Seems to work well now since i transfered the stack of var defs into the if func. I transfered the stack because i was still havimg issues getting the right answer for the overtime. Thanks guys!