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

شبااب انا ساويت البرنامج و لكن ارجوا انت تشوفوه هناك اخطأ

مغلق
بدأه tariq2002 في 9 ديسمبر 2001 · 7 رد · 562 مشاهدة · في ارشيف قسم C/C++
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم و كيف الحال إن شاء الله بخير و الله انا ساويت البرنامج الذي يدخل التاريخ والوقت بنفس البرنامج و لكن هناك اخطااء و هي ااني لا استطيع ان اضع الامر delay لكي اجعل الساعه تعمل على حسب سرعه الكمبيوتر و ثانيا ان clrscr();و الله صدعت منها كل ما اكتبها مكان تشطب شي و الله انا اسف و لك ن البرنامج مش واضح للعجله مم أمري الامتحانات و ارجوا المساعده

#include

#include

void time_update(struct time);

void gettodaysdate (void);

struct date {

int day,month,year;

};

struct time {

int hour, minutes, seconds;

};

struct date_time {

struct date sdate;

struct time stime;

};

int days[]={31,28,31,30,31,30,31,31,30,31,30,31};

struct date today,tommorow;

void gettodaysdate (void)

{

int valid=0;

while (valid==0)

{

printf("enter in the current year (1990-1999)-->");

scanf("%d",&today.year);

if( ( today.year<1990)||(today.year>1999) )

printf("

#2

للاسف شباااب بايين انه ما حد عنده الحل للأسف و الله في ناس دخلوا عليه و لا واحد ممكن يساعدني و لا شو وينك اخي نجيب اخت ورود اخي هاني و عادل و الله محتاجكم :( :( :( :o :o

#3

السلام عليكم

:)

اخ طارق غيرت في برنامجك شوي وحليت مشكلة ()clrscr

بس ما عرفت للdelay جرب تحط for loop

#include

#include

#include

struct date

{

int day,month,year;

};

struct time

{

int hour, minutes, seconds;

};

int days[]={31,28,31,30,31,30,31,31,30,31,30,31};

struct date today,tommorow;

void gettodaysdate ()

{

int valid=0,temp;

while (!valid)

{

printf("enter in the current year (1990-1999)-->");

scanf("%d",&today.year);

if( ( today.year<1990) || (today.year>1999) )

printf("

#4

شكرا لك جدا و الله انا اعجز عن الشكر و الله انك كدا (y) و إن شاء الله بيجي يوم و بردلك الجميل و شكراااا لك و انا بالنسبه للdely بضل اجرب فيها لما تشتغل بحط البرنامج كااااامل شكرااا لك :D :D ;) ;)

#5

السلام عليكم.

آسف أخي طارق على التأخير بسبب ظروف صعبة ...

على كل سبقتني الأخت ورود إلى تعديل مهم و هو تعديل إجراء tommorow_date حيث يجب أن يكون له بارامتر , و على فكرة لا يمكنك استخدام تعليمات الحلقة من أجل إجراء تأخير زمني و ذلك لأن زمن الحلقة سيتغير بتغير سرعة النظام !!

مع التحيات.

#6

شكرا لك اخ عادل و للاخت ورود و البرنامج اشتغل مع الclrscr(); و لكن ال delay انا إن شاء الله سوف اجرب اساويها و انا اعرف ان السرعه سوف تتغير بتغير سرعه الجهاز و لذلك لا نستطيع استخدام ال for loop و لذلك انا سوف اجرب طريقه اخرى و إن شاء الله بحاااول حتى تشتغل اوكي و شكراا لكم :D :D :D :D ;) ;) ;) ;)

#7

السلام عليكم...

تصدق اخي انه برنامجك هو سبب انضمامي للمنتدى ;)

المهم المشكلة هيك ان شاء الله انحلت... اذا كان عندك اي استفسار انا هون و ممكن تسأل

#include
#include
#include

struct Date
{
    int day,month,year;
};
struct Time
{
    int hour, minutes, seconds;
}; 

int days[]={31,28,31,30,31,30,31,31,30,31,30,31}; 
struct Date today,tommorow;
void gettodaysdate ()
{
    int valid=0,temp;
    while (!valid)
    {
        printf("enter in the current year (1990-1999)-->");
        scanf("%d",&today.year);
        if( ( today.year<1990) || (today.year>1999) )
            printf("07invalid yearn");
        else
            valid=1;
    }
  valid=0;
  while(!valid)
    {
        printf("enter in the current month (1-12)-->");
        scanf("%d",&today.month);
        if( ( today.month<1)&&(today.month>12) )
            printf("007invalid monthn");
        else
            valid=1;
    }
    valid=0;
    while (!valid)
   {
        printf("enter in the current day(1-%d)-->",days[today.month-1]);
      scanf("%d",&today.day);
        if( (today.day<1) || (today.day>days[today.month-1]))
            printf("07invalid dayn");
        else
        valid=1;
   }

}

void tommorow_date (struct Date newdate)
{

    tommorow=today;
   tommorow.day++;
    if(tommorow.day>days[tommorow.month-1])
    {
        tommorow.day=1;
        tommorow.month++;
        if(tommorow.month>12)
        {
            tommorow.year++;
            tommorow.month=1;
        }
    }
     gotoxy(32,10);
    printf("Today's date is %2d : %2d : %2dn",today.day,today.month,today.year);
   gotoxy(32,14);
   printf("Tommorow's date is %2d: %2d: %2dn",tommorow.day,tommorow.month,tommorow.year);
}

void time_update(struct Time new_time)
{
    int k=0;
   clrscr();

   tommorow_date(today);
    while((!kbhit())&&(k==0))
	{
	     delay(1000);
	    ++new_time.seconds;
	    if (new_time.seconds == 60)
	 {
		new_time.seconds = 0;
		new_time.minutes++;
		if(new_time.minutes == 60)
	    {
		    new_time.minutes=0;
		    new_time.hour++;
		    if(new_time.hour == 24)
			{
			    new_time.hour = 0;
		     today.day=tommorow.day ;
		     today.month=tommorow.month;
		     today.year=tommorow.year;
		     tommorow_date(today);


			}
		}

            }
      gotoxy(32,12);
    printf("The new time is %02d: %02d: %02dn",new_time.hour,new_time.minutes,new_time.seconds);


        }
}
void main()
{
    clrscr();
    struct Time current_time;
    printf ("Please enter the time now hhn");
    scanf("%d",&current_time.hour);
   printf ("Please enter the time now mmn");
   scanf("%d",&current_time.minutes);
   printf ("Please enter the time now ssn");
   scanf("%d",&current_time.seconds);
    gettodaysdate();
    time_update(current_time);
}
#8

شكرا لك اخ / اخت soma و الله كثيرا و انا سوف اجرب البرنامج و اشوف اذا اشتغل على البورلاند سي و إن شاء الله يشتغل و انا كمان سوف اضع حلي لاني اقتربت من الحل الصحيييح و إن شاء الله يشتغل و عندما يشتغل سوف اضعه إن شاء الله و شكراااا لك كثيييرا على المسااعده و اهلا و سهلا بك بالمنتدى و إن شاء الله نستفيد من بعض إن شاء الله باااي ;) :D ;) :D

هذا الموضوع مغلق.

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

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…