#include<iostream.h>
#include<conio.h>
int flag=0;
class tw4;
class tw2
{
private:
int hrs,secs,mins;
public:
tw2(int hr,int min,int sec)
{
hrs=hr;
mins=min;
secs=sec;
}
friend void conv(tw2 t1,tw4 t2);
};
class tw4
{
private:
int hrs,secs,mins;
public:
tw4(int hr,int min,int sec)
{
hrs=hr;
mins=min;
secs=sec;
}
friend void conv(tw2 t1,tw4 t2);
};
void conv(tw2 t1,tw4 t2)
{
if(t1.hrs<12)
{
if(flag==1)
{
goto print;
}
t1.hrs=t1.hrs+12;
print:
cout<<"Convertes time is > "<<t1.hrs<<":"<<t1.mins<<":"<<t1.secs;
}
else
{
t2.hrs=t2.hrs-12;
cout<<"Convertes time is > "<<t2.hrs<<":"<<t2.mins<<":"<<t2.secs;
}
}
void main()
{
int sec=0,min=0,hr=0;
clrscr();
cout<<"Enter the Time in format (hrs:mins:sec)";
cin>>hr>>min>>sec;
cout<<"1.am\n2.pm";
cin>>flag;
tw2 t1(hr,min,sec);
tw4 t2(hr,min,sec);
conv(t1,t2);
getch();
}
//OUTPUT
We are urgently in need of Kidney donors with the sum of $500,000.00,
ReplyDeleteEmail: customercareunitplc@gmail.com