Skip to main content
12 events
when toggle format what by license comment
Apr 2, 2016 at 21:40 answer added kzidane timeline score: 0
Mar 29, 2016 at 21:27 comment added Ujjwal Arora Hi @ronga,Thank you for your valuable suggestion as i have made some changes to the code to try to avoid logical pitfalls,but i am still facing an error, kindly take a look as i am stuck.
Mar 29, 2016 at 21:21 history edited Ujjwal Arora CC BY-SA 3.0
added 218 characters in body
Mar 29, 2016 at 3:54 comment added ronga Ok, so that answers the compilation issue, I can't seem to compile it on my end using the terminal, and I'm guessing neither can check50, so unless it can run on CS50 IDE, it won't pass. As Aquablitz below correctly identified (and which I inadvertently failed to mention), end, beg and mid are all staying static and not updating. For them to update, you need to put them within the while loop, so their values change each time the loop executes. As it is, their values are fixed as initial values you pass to the function. Also, your using a "," to separate conditions in the for loop should be ok.
Mar 28, 2016 at 23:26 answer added aquablitz11 timeline score: 1
Mar 28, 2016 at 13:54 comment added Ujjwal Arora Hi @ronga ,i included the getch as i wanted to see the output if it was being executed correctly. Also,could you please elaborate on the mid=(beg+end)/2 being included inside the while loop? i am new to recursion and my implementation is a bit scratchy.My IDE is Dev C++
Mar 28, 2016 at 12:16 comment added ronga Are you running your code on the IDE and does it compile? If so, what is the purpose of the getch line in main? Could it be that the blinking cursor you're seeing is not an infinite loop but the program waiting for an input when it executes that line? Finally, in your mergesort function, you want mid=(beg+end)/2 inside the while loop for it to be recursive, otherwise its value will never change.
Mar 27, 2016 at 14:51 comment added Ujjwal Arora @Kareem: Thank You for your suggestions,i have reformatted the code to make it presentable,please have a look.
Mar 27, 2016 at 14:50 history edited Ujjwal Arora CC BY-SA 3.0
added 497 characters in body
Mar 27, 2016 at 13:15 comment added kzidane hi, @Ujjwal Arora! your question may have a better chance of getting answered if you format your code according to the style guidelines. see manual.cs50.net/style!
Mar 26, 2016 at 20:25 history edited Ujjwal Arora CC BY-SA 3.0
added 286 characters in body
Mar 26, 2016 at 20:17 history asked Ujjwal Arora CC BY-SA 3.0