C++ "Stopuhr"

Daedalus

Midnight Stalker
Hi ^^
Ich bräuchte ma die befehle für ne C++ Konsolenanwendung, mit der man sowas wie ne stopuhr machen kann... also ne zeitspanne messen... Beispielweise Fängt man mit nem Programm an, die "stopuhr" wird gestartet und beim programmende wird die vergangene zeit angezeigt... sowas wär echt nett von euch.
 
hab mich mal an der stopuhr versucht, aber nich mit der konsole. . . naja is alles n bissel komisch . . . aber ich bin auch nich so der checker in c++



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

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
Edit1->Text = ("1");
if (Edit1->Text == ("1"))
{
Timer1->Enabled = false;
Timer2->Enabled = true;
}
}
//---------------------------------------------------------------------------

void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
Timer1->Enabled = true;
Timer3->Enabled = true;
Timer6->Enabled = true;

Edit1->Text = ("0");
Edit2->Text = ("0");
Edit3->Text = ("0");
}
//---------------------------------------------------------------------------

void __fastcall TForm1::BitBtn2Click(TObject *Sender)
{
Timer2->Enabled = false;
Timer4->Enabled = false;
Timer7->Enabled = false;

}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer2Timer(TObject *Sender)
{
Edit1->Text = Edit1->Text - (-1);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Timer3Timer(TObject *Sender)
{
Edit2->Text = ("1");
if (Edit2->Text == ("1"))
{
Timer3->Enabled = false;
Timer4->Enabled = true;
}


}
//---------------------------------------------------------------------------

void __fastcall TForm1::Timer4Timer(TObject *Sender)
{
Edit2->Text = Edit2->Text - (-1);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Timer5Timer(TObject *Sender)
{
if (Edit2->Text == ("101"))
{
Edit2->Text = ("1");
}
if (Edit1->Text == ("61"))
{
Edit1->Text = ("1");
}
}
//---------------------------------------------------------------------------


void __fastcall TForm1::Timer6Timer(TObject *Sender)
{
Edit3->Text = ("1");
if (Edit1->Text == ("1"))
{
Timer6->Enabled = false;
Timer7->Enabled = true;
}
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Timer7Timer(TObject *Sender)
{
Edit3->Text = Edit3->Text - (-1);
}
//---------------------------------------------------------------------------
 
oha x_x
naja bis ich das versteh dauerts wohl nowas *gg* trotzdem vieln dank. Un da hab ich noch ne frage, nämlich wie man in konsolenanwendungen Repeat ... Until benutzen kann. Mit GoTo kann ichs au machn, aber das is saumäßig unübersichtlich und hässlich.
 
Zurück
Oben Unten