czwartek, 2 marca 2017

My time_class in Visual C++

time_class.h

#pragma once
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

ref class time_class
{
private:
DateTime begin_time;
String^ time_Minutes;
String^ time_Seconds;
TimeSpan^ time_work;
public:
time_class(void);
void Read();
void Write();

};

time_class.cpp

#include "StdAfx.h"
#include "time_class.h"

time_class::time_class(void)
{
begin_time=DateTime::Now;


}
void time_class::Read()
{
time_work=gcnew TimeSpan();
DateTime temp_time;
temp_time=DateTime::Now;
time_work=temp_time-begin_time;
time_Minutes=time_work->Minutes.ToString()+ " minutes ";
time_Seconds=time_work->Seconds.ToString()+ " seconds ";


}
void time_class::Write()
{
MessageBox::Show("Time work is: "+time_Minutes+":"+time_Seconds,"TIME",MessageBoxButtons::OK,MessageBoxIcon::Information);
}

Brak komentarzy:

Prześlij komentarz