Long Calculation - Help in Division Needed! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Long Calculation - Help in Division Needed!

I have been trying to solve a challenge posted by $Vengat - Long Calculation (https://www.sololearn.com/Discuss/729467/challenge-long-calculation). Yash Thatte supplied me a code with Addition and Subtraction and asked me to solve Multiplication and Division. I have completed Multiplication, but am unable to properly implement Division. Here is my code : https://code.sololearn.com/cmUeBCJgER8M/#cpp In my code, when I input 92793/59, I get a correct division executed. However, when I input 42/7, the positions get messed up. And when I input 529/23, the remainders after partial subtraction are calculated wrongly, while this does not happen for inputs like 92793/69, 9279/59, 9944/34 (this has some digits misplaced). Please help me in solving the challenge correctly. Also, I got an error in Code Playground stating that to_string() was not declared in the scope. In my program, I have included <string> and my program successfully executes on Code::Blocks. So, is it that Code Playground lacks full C++11 support?

27th Sep 2017, 10:34 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
2 Answers
+ 4
I guess Ill redesign my code just for single digit remainders... For those, the algorithm becomes simple... But what I am to do of to_string()? Any help?
28th Sep 2017, 2:44 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 2
Yes, it seems Sololearn doesn't compile with std=c++11, although it already supports new things like class enumerations. I am just going to link my thread, maybe you will find a helpful link... https://www.sololearn.com/discuss/747837/?ref=app
28th Sep 2017, 9:15 PM
Shadow
Shadow - avatar