Hi, I'm a student just learning c. I have an assignment that is killing me. I have to write a code that will produce the angle of a clocks hands. This is my third assignment I have done the 'hello' and calculated miles to feet and converted fahrenheit to celsius with little problem. This is confusing me greatly and I would like some help please with writing this. Any tips would be greatly appreciated. I'm hoping not to have someone write it for me but to assist me in writing it for myself.
Thank you

Recommended Answers

All 9 Replies

Are you talking about the angle between the minute hand and the hour hand, measured at intervals.

dude, this is really freakin easy.

360 degrees in a circle.

60 minutes in a circle

6 degrees per minute

1 degree per 10 seconds

0.1 degree per second.

you can have 10 second resolution and only use integers.

if you need 1 second resolution, you're still only in tenths of degree, the math is elementary.

I think this program is really easy, I tell you why:

When the user inputs the data forexample hours , minutes and seconds. It is possible to convert that into angles. On calculators there is special button to do that as well. You can check this link below and that should be it :]
http://id.mind.net/~zona/mmts/trigonometryRealms/degMinSec/degMinSec.htm

FWIW, that's not correct. You can have a bearing for a ship in degrees/minutes/seconds and it has nothing to do with time or the clock. Minutes are a division of degrees and seconds are divisions of a minute. See this which also calls them arcminutes and arcseconds.

(Pardon the off topic post and I know this thread is getting a little stale. Sometimes you can get good baked goods on the day old shelf in the grocery store though)

commented: i like the day old donuts, myself. +7

Isn't this a trig function?

Thanks for the link. But honestly I think that page has the same concept will less information for sure.

How would you convert:

40 hours 20mins and 10 seconds in angle? Using the same technique right? So i don't know why there is a problem with my answer :]

40 hours 20mins and 10 seconds in angle?

There's no such thing. Hours are not a measure of an angle. It so happens in this example that the OP posted you can find a relationship between the length of the hands on the clock, the angle between them, but this is merely artificial and has no bearing on the time.

Take another look at it. Angles are measured in degrees, minutes, seconds. These are unrelated to hours, minutes, seconds. The degree is divided up into 60 parts which is why they happen to call it a "minute."

See also: http://en.wikipedia.org/wiki/Minute_of_arc

You are so correct, I got it thanks

Moral of the story "Hours is not a unit of angle " :]

No biggie, it happens to everybody.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.