الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

دالة فحص التاريخ لا تعمل في Dev C++

بدأه FastCode2010 في 25 فبراير 2009 · 4 رد · 813 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكــم ورحمـة الله وبركاتــة ،،

من فتره طرحت موضوع عن دالة فحص التاريخ

والشكر الجزيل الى الاخوين

GamingMasteR

ASPHP

للمساعدة في ايجاد الداله

الكود يعمل في فيجول ستوديو 6 بشكل كامل ولكن كيف اجعله يعمل في Dev c++ لان مشروعي بواسطته

الكود هو

#include <afx.h>
int main()

{

CTime BOOMTime(2009, 3, 7, 0, 0, 0 );

CTime SystemTime= CTime::GetCurrentTime();

printf("%u/%u/%u \n", SystemTime.GetYear(), SystemTime.GetMonth(), SystemTime.GetDay());

if (SystemTime >= BOOMTime)

printf("BOOM !\n"); // will boom

else

printf("NOT BOOM !\n"); // will not boom

getchar();

return EXIT_SUCCESS;

}

الاخطاء كالتالي

:1:17: afx.h: No such file or directory

: In function `int main()':

:6: error: `CTime' undeclared (first use this function)

:6: error: (Each undeclared identifier is reported only once for each function it appears in.)

:6: error: expected `;' before "BOOMTime"

:7: error: expected `;' before "SystemTime"

:9: error: `SystemTime' undeclared (first use this function)

:9: error: `printf' undeclared (first use this function)

:10: error: `BOOMTime' undeclared (first use this function)

:14: error: `getchar' undeclared (first use this function)

:15: error: `EXIT_SUCCESS' undeclared (first use this function)
#2

السلام عليكــم ورحمـة الله وبركاتــة ،،

اقتباس
afx.h: No such file or directory, CTime

Don't copy and paste from MFC projects.

It is problem of compatibility

#3

السلام عليكــم ورحمـة الله وبركاتــة ،،

time_t t1,t2;

struct tm tm;

tm.tm_hour=10;

tm.tm_min=30;

tm.tm_sec=0;

tm.tm_mon=2;

tm.tm_mday=1;

tm.tm_year=109;



t1=mktime(&tm); // 1 apr 2009

t2=time(NULL); // 



if(t1>=t2){ //or until the All Fools Day 2009

// do someting



}

else 

// do someting 
return 0;

تم تعديل هذه المشاركة بواسطة FastCode2010 في 26 فبراير 2009 في 19:23

#4
#include <windows.h>
#include <stdio.h>

int main()
{
	SYSTEMTIME st, lt;

	GetSystemTime(&st);
	GetLocalTime(&lt);

	printf("The system time is: %02d:%02d\n", st.wHour, st.wMinute);
	printf(" The local time is: %02d:%02d\n", lt.wHour, lt.wMinute);
	getchar();
}

راجع ارابط

tvquran_6.gif

#5

هنا مرجع لاستخدام دوال الوقت على الـ C و الـ CPP

CTime

و كما قال الأخ بنالعيد:

اقتباس
afx.h: No such file or directory, CTime

Don't copy and paste from MFC projects.

It is problem of compatibility

حيث أنه لا يوجد Object جاهز تحت اسم CTime و إنما هذه مكتبة تحتوي على Objects, Macros, Datatype

Chao!!!

Great place, and people, but full of sectarianism.

مواضيع مشابهة