المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : مساعدة في برمجة برنامج محاكي اشارات المرور بالـ C++ Builder


eshrag.net
08-07-2010, 07:00 PM
السلام عليكم و رحمة الله و بركاته
مطلوب مني برمجة برنامج بالـ C++ Builder يكون فيه قائمة File فيها Restart و Exit على الأقل و 4 اشارات مرور و كل اشارة مرور معها عداد
حالياً انا برمجت البرنامج و فيه القائمة file فيها exit ناقصني Restart لإعادة عمل البرنامج من البداية و ناقصني العداد المصاحب لكل اشارة مرور , المشكلة انو تسليم المشروع يوم الأربعاء و حاولت و ما قدرت اصل لحل في باقي البرنامج
البرنامج النموذج المراد عمل شبيه له :-
http://www.mediafire.com/?gbdo8r3tgblvm2s
درجات المشروع تحسب على الزيادات في البرنامج أي انه اذا تم تصميم البرنامج كما هو تأخذ نصف الدرجة

عملي في المشروع حتى الآن : -
http://www10.0zz0.com/2010/08/07/18/514712187.jpg

الكود المبرمج به برنامجي
كود:
//---------------------------------------------------------------------------
#include
#pragma hdrstop

#include "TrafficLightSimulation.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
void __fastcall TForm1::close1Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
// If the current color is red
if( shpRed->Brush->Color == clRed )
{
// Change the color to green
Timer1->Interval = 3500;
shpRed->Brush->Color = clSilver;
shpYellow->Brush->Color = clSilver;
shpGreen->Brush->Color = clGreen;
}
// But if the color is green
else if( shpGreen->Brush->Color == clGreen )
{
// Change the color to yellow
Timer1->Interval = 2000;
shpRed->Brush->Color = clSilver;
shpYellow->Brush->Color = clYellow;
shpGreen->Brush->Color = clSilver;
}
// Otherwise, if the color is yellow
else // if(shpYellow->Brush->Color == clYellow
{
// Change the color to red
Timer1->Interval = 18600;
shpRed->Brush->Color = clRed;
shpYellow->Brush->Color = clSilver;
shpGreen->Brush->Color = clSilver;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::shpRedMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer2Timer(TObject *Sender)
{
// If the current color is red
if( shpRed2->Brush->Color == clRed )
{
// Change the color to green
Timer2->Interval = 3500;
shpRed2->Brush->Color = clSilver;
shpYellow2->Brush->Color = clSilver;
shpGreen2->Brush->Color = clGreen;
}
// But if the color is green
else if( shpGreen2->Brush->Color == clGreen )
{
// Change the color to yellow
Timer2->Interval = 2000;
shpRed2->Brush->Color = clSilver;
shpYellow2->Brush->Color = clYellow;
shpGreen2->Brush->Color = clSilver;
}
// Otherwise, if the color is yellow
else // if(shpYellow2->Brush->Color == clYellow
{
// Change the color to red
Timer2->Interval = 19000;
shpRed2->Brush->Color = clRed;
shpYellow2->Brush->Color = clSilver;
shpGreen2->Brush->Color = clSilver;
}

}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer3Timer(TObject *Sender)
{
// If the current color is red
if( shpRed3->Brush->Color == clRed )
{
// Change the color to green
Timer3->Interval = 3500;
shpRed3->Brush->Color = clSilver;
shpYellow3->Brush->Color = clSilver;
shpGreen3->Brush->Color = clGreen;
}
// But if the color is green
else if( shpGreen3->Brush->Color == clGreen )
{
// Change the color to yellow
Timer3->Interval = 2000;
shpRed3->Brush->Color = clSilver;
shpYellow3->Brush->Color = clYellow;
shpGreen3->Brush->Color = clSilver;
}
// Otherwise, if the color is yellow
else // if(shpYellow3->Brush->Color == clYellow
{
// Change the color to red
Timer3->Interval = 18800;
shpRed3->Brush->Color = clRed;
shpYellow3->Brush->Color = clSilver;
shpGreen3->Brush->Color = clSilver;
}

}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer4Timer(TObject *Sender)
{
// If the current color is red
if( shpRed4->Brush->Color == clRed )
{
// Change the color to green
Timer4->Interval = 3500;
shpRed4->Brush->Color = clSilver;
shpYellow4->Brush->Color = clSilver;
shpGreen4->Brush->Color = clGreen;
}
// But if the color is green
else if( shpGreen4->Brush->Color == clGreen )
{
// Change the color to yellow
Timer4->Interval = 2000;
shpRed4->Brush->Color = clSilver;
shpYellow4->Brush->Color = clYellow;
shpGreen4->Brush->Color = clSilver;
}
// Otherwise, if the color is yellow
else // if(shpYellow4->Brush->Color == clYellow
{
// Change the color to red
Timer4->Interval = 18700;
shpRed4->Brush->Color = clRed;
shpYellow4->Brush->Color = clSilver;
shpGreen4->Brush->Color = clSilver;
}

}

//---------------------------------------------------------------------------
void __fastcall TForm1::Exit1Click(TObject *Sender)
{
Close() ;
}
//---------------------------------------------------------------------------