Time conversion and I/O streams

Hey so I got this code that uses a function to prompt for current time in 24 hour format. I now need to write another function that converts the hours to 12 hour format and adds am or pm. But the function is not suppose to print anything, only store the data then use another function to print using I/O streaming. I haven't had any experience with I/O streaming so any help would be appreciated

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void main()
{
int hour1=0;
char ch1;
int minutes1=0;

getTime24(hour1, ch1, minutes1);
}

void getTime24(int& hour, char& ch, int& minutes)
{
cout << "Enter a time in 24 hour format (for example 13:45): ";
cin >> hour >> ch >> minutes; 

	while (hour < 0 || hour > 24 || minutes < 0 || minutes > 60) 
	{
		cout << "I'm sorry the information you entered is not valid. Please try aagin " << endl;
		cin >> hour >> ch >> minutes; 
	}
}
Topic archived. No new replies allowed.