+ 1

C program need help

hi, this is probably a REALLY simple mistake. But why is this code not functioning properly? https://www.sololearn.com/compiler-playground/cS1cxt9wlxVK

20th Oct 2022, 8:48 PM
Jami Finn
Jami Finn - avatar
10 Answers
+ 3
Yes. Looks like you pass the arguments for fractionToDecimal in the wrong order, ll. 37 and 51.
20th Oct 2022, 9:26 PM
Ani Jona 🕊
Ani Jona 🕊 - avatar
+ 3
The overall design of those functions is not good by the way. You ought to focus them on what they do, not how they are used in your program. I mean, fractionToDecimal should just take the numerator and the denominator as arguments, nothing else. That function should not be concerned about if those values were calculated and calculated through addition or subtraction. That information is not needed to convert a fraction into a decimal representation, right? Then don't put it in there.
20th Oct 2022, 9:30 PM
Ani Jona 🕊
Ani Jona 🕊 - avatar
+ 2
Code is cutoff. This is not readable code. Better to post it as link by saving in playground https://www.sololearn.com/post/75089/?ref=app
20th Oct 2022, 8:58 PM
Jayakrishna 🇮🇳
+ 1
Would that be Lab3L2? What seems to be the trouble?
20th Oct 2022, 9:09 PM
Ani Jona 🕊
Ani Jona 🕊 - avatar
+ 1
Wrong assignment in parameters in function definition or in passing. Use this: double fractionToDecimal(int numeratorAddition, int numeratorSubtracted , int denominatorComputed, int operationVariable ) better Use a readable short form names for variables.
20th Oct 2022, 9:31 PM
Jayakrishna 🇮🇳
+ 1
You're a god send, thank you
20th Oct 2022, 9:35 PM
Jami Finn
Jami Finn - avatar
0
Its Program03, I'm pretty sure I linked it...
20th Oct 2022, 9:14 PM
Jami Finn
Jami Finn - avatar
0
I'm afraid I don't see it then 😔 i cannot follow that link from the app...
20th Oct 2022, 9:15 PM
Ani Jona 🕊
Ani Jona 🕊 - avatar
0
Try now?
20th Oct 2022, 9:16 PM
Jami Finn
Jami Finn - avatar
- 1
Also this was a stupid assignment and I'm not even supposed to be using if else statements, my teacher wants its a specific way or I wouldn't be writing like this. He doesn't like abbreviated variables, or any normal program ideas. And he's stubborn af
20th Oct 2022, 9:40 PM
Jami Finn
Jami Finn - avatar