Anonymous
Iirc
vinícius*
%.nf
yeah but from I understood he wants a way to set the precision depending on runtime input
vinícius*
so he'd need to use the thing I sent (in C)
vinícius*
Brown
yeah but this works for C
Okay, Thank you. I'll try it.
Prem Narayan Singh
/getfreeprogrammingbook
Anonymous
Dynamis
Write a C programming to find the angle between (12:00 to 11:59) the hour hand and the minute hand of a clock. The hour hand and the minute hand is always among 0 degree and 180 degree. For example, when it's 12 o'clock, the angle of the two hands is 0 while 3:00 is 45 degree and 6:00 is 180 degree. Can somebody please tell me the logic?
klimi
Its just math
klimi
Its just simple math tbh
Dynamis
Its just math
Tell then
klimi
Tell then
1. Look at the clock 2. Calculate the angle 3. Done
Anonymous
Tell then
6 degree
Anonymous
Math is (360 deg /60 min) *(12:00-11:59)
Anonymous
Anonymous
Finding the angle between the hour and minute hand is not simple
klimi
How so....
Dynamis
Math is (360 deg /60 min) *(12:00-11:59)
I got this but what if I want to find between 1:20 or 2:40 like this
Anonymous
How so....
One way is to calculate relative position
Anonymous
Example every 12 hours the hour hand moves 360
Anonymous
But every 1 hour the minute hand moves 360
klimi
Ya, or you can calculate the angles and then find the diff
Pavel
Write a C programming to find the angle between (12:00 to 11:59) the hour hand and the minute hand of a clock. The hour hand and the minute hand is always among 0 degree and 180 degree. For example, when it's 12 o'clock, the angle of the two hands is 0 while 3:00 is 45 degree and 6:00 is 180 degree. Can somebody please tell me the logic?
1) You can calculate angle (from 0:00) of the hour hand. To do that you just divide 360 by 12 and multiply by your 12hr time in hours (e.g. 8:30 becomes 8.5f, 9:20 becomes 9.33f). To make hours 12hr from 24hr, just substract 12 if it's greater or equal to 12:00. 2) You can calculate angle (from 0:00) of the minute hand almost the same way. You take your minutes of the current hour and do the same math. Minutes * 360 / 60. It's called linear interpolation (lerp) by the way. 3) you have two angles, you find the difference and take absolute value from it Any questions?
Anonymous
Holy errors batman (I added some suggested modifications)
this is C++, so this is a terrible program C - you shouldn't use rand() for anything other than the most basic programs. C++ - never use rand()
Pavel
How 9:20 became 9.33?
9.0f + (20.0f / 60.0f)
Monday Morning
Any idea?
Have you tried your hands on printing star patterns ?
Monday Morning
That is the building block of these questions.
Anonymous
Have you tried your hands on printing star patterns ?
I think you didn't like my program. It doesn't matter a lot. It is not my best. What matters is: can you find the magic math equation that solves something like this? While someone said that it is simple enough for 9th grade students.
Anonymous
We've had so many things we learned in school we don't remember everything
Anonymous
As for the star pattern just copy it from somewhere online
klimi
Uh you dont have to learn something more if you dont want to
Anonymous
C++++
Arseny
Do you think you already know C++?
Anonymous
Do you think you already know C++?
Bro you ever hear of error 577329984%478?
Alion🦁
Do you think you already know C++?
😅if someone thinks it, it means he doesn't know anything 🤣🤣
Anonymous
I have 6 year s experience on c++, but i don't know about c++
Arseny
I have 6 year s experience on c++, but i don't know about c++
More than 10 years of commercial experience - the same problem )
Alion🦁
Then bye, I am leaving 😜😅
Alion🦁
I can't learn this))) 😅
Arseny
I can't learn this))) 😅
Maybe, you need not to? Especially, if you're fullstack/mobdev..
Alion🦁
Haha, we're working OS development))
Alion🦁
In free times, you see.
Arseny
OS development? Proprietary or any free one?
Anonymous
Atomic type can solve race conditions?
Alion🦁
OS development? Proprietary or any free one?
We should continue it in OT group 😊if you want
Arseny
Atomic type can solve race conditions?
It depends. Sometimes yes, sometimes no
Arseny
We should continue it in OT group 😊if you want
I don't know anything about OT group
Arseny
Atomic type can solve race conditions?
Atomic solves race condition on this current variable.
Alion🦁
Atomic solves race condition on this current variable.
Yesterday, at 1 o'clock you entered
Arseny
Yesterday, at 1 o'clock you entered
Yeah, i've seen it, but i didn't understand the purpose
Alion🦁
Yeah, i've seen it, but i didn't understand the purpose
The purpose is speaking other things like for example, OS dev and etc. Except, c c++
Alion🦁
I see, thx for clarification 👍
most welcome 👍🏻💚
Anonymous
Anonymous
If i put struct into atomic type?
Arseny
If i put struct into atomic type?
Sounds like using struct under mutex
Anonymous
Any modifications to this struct also guarantee thread safe?
Anonymous
Atomic‹struct› t;
Anonymous
Thanks
Anonymous
crt
what does undefined reference to `[vtable or typeid] for [classname]` mean
Arseny
what does undefined reference to `[vtable or typeid] for [classname]` mean
Do you read this faq? It looks similar to your problem http://gcc.gnu.org/faq.html#vtables
crt
so all virtual funcs must be declared, which i've done
crt
same for constructors
crt
hm
crt
i have the renderer object declared as a pointer to the base class of the 2d renderer