Passing strings through C++

Using these rules below, I must make a program that takes to inputs of time on a 24 hour clock. Depending on whether time1 is higher or lower than time2, say the difference in time shown as "x hours and y minutes" (later or earlier) depending on the actual difference. So 01:00 is 20 hours and 10 minutes from 21:10.
Here are functions to be used.
And here is my code at end.
#include <iostream>
#include <string>
using namespace std;

// Reads a time hr:min from user and returns the time as the number of minutes
// from 0:00. Calls the SerialTime() function to perform the conversion.
unsigned int ReadTime(const string prompt);

// Returns the serial number for the specified time. The serial number is
// the total number of minutes from 0:00.
unsigned int SerialTime(const int Hour, const int Minute);

// Returns the hour component of the serial number.
int HourFromSerialTime(const unsigned SerialTime);

// Returns the minute component of the serial number.
int MinuteFromSerialTime(const unsigned SerialTime);

// Returns the time elapsed from SerialTime1 to SerialTime2 in minutes. If
// SerialTime2 is later than SerialTime1, then the return value is positive,
// if SerialTime2 is earlier than SerialTime1, then the return value is
// negative, else it is zero.
int ElapsedTime(const unsigned int SerialTime1,
const unsigned int SerialTime2);

// Displays the two times and a message indicating whether time2 is later or
// earlier than time1. Calls the HourFromSerialTime() and MinuteFromSerialTime()
// functions to get the hour and minute components. It then displays:
// hr:min is nnn hour(s) and mmm minute(s) later|earlier than hr:min.
void DisplayInterval(const unsigned int SerialTime1,
const unsigned int SerialTime2);

int main()
{

return (0);
} // end main()

------------------------------------------------------------------------------
HERE IS MY CODE
#include <iostream>
#include <string>
using namespace std;

unsigned int ReadTime(const string prompt);
unsigned int SerialTime(const int Hour, const int Minute);
int HourFromSerialTime(const unsigned SerialTime);
int MinuteFromSerialTime(const unsigned SerialTime);
int ElapsedTime(const unsigned int SerialTime1,
const unsigned int SerialTime2);
void DisplayInterval(const unsigned int SerialTime1,
const unsigned int SerialTime2);

int main()
{string prompt1, prompt2;
int totaltime,x,y;
prompt1="Enter the first time [hh:mm]: ";
prompt2="Enter the second time [hh:mm]: ";
cout<<"Programmed by ";
cout<<endl<<endl;
ReadTime(prompt1);
ReadTime(prompt2);
totaltime=x-y;

}
unsigned int ReadTime(const string prompt)
{
char colon;
int hour, min;
cout<<prompt;
cin>>hour>>colon>>min;
return 0;
}
unsigned int SerialTime(const int Hour, const int Minute)
{
int totaltime;
totaltime=0;
totaltime=Hour+Minute;
return (totaltime);

}
int HourFromSerialTime(const unsigned SerialTime)
{
int hr;
hr=SerialTime/60;
return (hr);
}
Topic archived. No new replies allowed.