Перевод времени в секунды. :)

//------------------------------------------------------------------------------------------------
#include <iostream>
#include <conio.h>

using namespace std;

struct Time
{
unsigned int hour;
unsigned int minute;
unsigned int sec;
};
//--------------------------------------
unsigned int timesec(Time);
//-------------------------------------------
int main()
{
Time tik;
char ch='a';
while (ch!='n')
{
cout<<"Enter the kol-vo hour: "; cin>>tik.hour;
cout<<"Enter the kol-vo minute: "; cin>>tik.minute;
cout<<"Enter the kol-vo secund: "; cin>>tik.sec;
cout<<"Time in secund: "<<timesec(tik)<<endl;
cout<<"Continue? (y/n): "; cin>>ch;
cout<<endl;
}
return 0;
}
//--------------------------------------------------
unsigned int timesec(Time t)
{
unsigned cool=t.sec+t.minute*60+t.hour*3600;
return cool;
}

//------------------------------------------------------------------------------------------------

Хакинг | Главная | Программирование

Hosted by uCoz