36 Reputation Points
Ranked #630
- Strength to Increase Rep
- +3
- Strength to Decrease Rep
- -0
100% Quality Score
- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
0 Endorsements
Ranked #107.49K
Re: Some of the solutions posted here are not quite correct. Zero in 24 hour time is 12:00 AM. Try this: [code=c++] void convertTo12Hour(int hour24, int& hour12, char& ampm) { hour12 = hour24 % 12; if (hour12 == 0) hour12 = 12; ampm = (hour24 < 12) ? 'a' : 'p'; … |