Hello everyone, i got a question, but cant figure it out
here's the question:
Declare a structure to hold the time. It should have 2 members: one for hours and one for
minutes (each as integers).
Declare another structure for date. It should have 3 members: one for day, one for month
and a third one for year.
Write a program which makes use of these two structures and prompts the user to enter
two times (in hours and minutes) i.e. a departure time + a journey time as well as the
departure date. The program should also be able to read a series of departure time ,
Journey time and departure date from a data file (input file). The program will then
add together these two times ensuring that the answer is valid (minutes are less than 60
and hours are less than24). Based on this the program will display the departure date, the
departure time, the journey time, the arrival time and the arrival date. The final resultant
time will then be displayed on the screen and to an output file.
Both the input times and the resulting time should be stored using the previously
declared structure.
i try it, but as my new with this i dont know if am goin in the rigth way.
here's the code:
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
struct time
{
int hours;
int minutes;
};
struct date
{
int day;
int month;
int year;
};
int n,ID;
static struct date departuredate[10];
cout<<"Enter departure date\n";
cin>>n;
int i=0;
while (i<n)
{
cout<<"Enter departure date\n";
cin >> departuredate[i].day;
cin >>departuredate[i].month;
cin >> departuredate[i].year;
i++;
}
for (i=0; i<n; i++)
{
cout<<"departuredate:"<< departuredate[i].day<<"\t"<<departuredate[i].month"\t"<< departuredate[i].year << "\n" ;
}
system("PAUSE");
return EXIT_SUCCESS;
}
Any help please
i reall y need it as soon as possible
please help
URGENT PLEASE!!