Some problems in my code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Some problems in my code

Here is a code in C++ for an app that calculates the angle between the two pointers of the clock in a certain time. However, there seems to be some logical errors. I would appreciate any help that I can get. https://code.sololearn.com/cZHE3lOc0L95/?ref=app

20th Aug 2018, 3:09 PM
Abdulaziz Shamma
Abdulaziz Shamma - avatar
6 Answers
+ 2
bro! We are talking about real clocks, you must notice that the hour hand at 12:30 is NOT on 12.. It's exactly in the middle between 12 & 1, and that will surely change the angle.. That's the purpose of 25th line. Did you understand now?
21st Aug 2018, 10:31 AM
Abdulaziz Shamma
Abdulaziz Shamma - avatar
+ 1
You haven't checked if the inputs are negative values. And you can write the assignment in shorter versions while still preserve readability.
20th Aug 2018, 3:41 PM
Hoàng Nguyễn Văn
Hoàng Nguyễn Văn - avatar
+ 1
I managed the negative values stuff but I still can't understand the other problems you find
20th Aug 2018, 3:46 PM
Abdulaziz Shamma
Abdulaziz Shamma - avatar
+ 1
25th line is important because I the hand of hour's place changes through the minutes
20th Aug 2018, 3:58 PM
Abdulaziz Shamma
Abdulaziz Shamma - avatar
+ 1
K get it. Sorry for that
21st Aug 2018, 10:31 AM
Hoàng Nguyễn Văn
Hoàng Nguyễn Văn - avatar
+ 1
No problem 😊
21st Aug 2018, 10:43 AM
Abdulaziz Shamma
Abdulaziz Shamma - avatar