Thursday, 5 July 2012

Program that demostrate used of structure in c++.

#include<iostream>
using namespace std;

struct time_struct
{
int hour,minute,second;
};

int main()
{
time_struct st;
cout<<"Enter hour";
cin>>st.hour;
cout<<endl;

cout<<"Enter minute";
cin>>st.minute;
cout<<endl;

cout<<"Enter second";
cin>>st.second;
cout<<endl;

cout<<"The time is :-   "<<st.hour<<": "<<st.minute<<": "<st.second;

return 0;
}