بنت اليم
31-12-2007, 02:13 PM
السلام عليكم ورحمة الله وبركاته
ممكن تساعدوني إذا ممكن يا اخواني واخواتي .....أنا ماكنت حاضرةلأسبوعين الجامعة بسبب إني كنت مريضة وخلال هالاسبوعين تم شرح class و overloading وهذا السؤال الي وجدته بالكتاب يتعلق بهم ممكن احد يساعندي بحلة ويقولي شلون حله؟
Define a class named Date that has three integer value representing hour, minute, and year with the following operations:
· Default constructor that initializes the date to 1/1/1980.
· A function that sets the date to any sensible values.
· Prints the date in a proper format.
· A function that overloads the == operator as a member function.
· A function that overloads the == operator as a non-member function.
In the main function:
· Define 2 objects with different dates.
· Print the dates.
· Apply the above defined 2 functions for == to compare the above defined dates and print “The dates are similar” or “The dates are different” accordingly.
· Assign the second date to the first date, print the dates, and compare them again by repeating the previous step.
ممكن تساعدوني إذا ممكن يا اخواني واخواتي .....أنا ماكنت حاضرةلأسبوعين الجامعة بسبب إني كنت مريضة وخلال هالاسبوعين تم شرح class و overloading وهذا السؤال الي وجدته بالكتاب يتعلق بهم ممكن احد يساعندي بحلة ويقولي شلون حله؟
Define a class named Date that has three integer value representing hour, minute, and year with the following operations:
· Default constructor that initializes the date to 1/1/1980.
· A function that sets the date to any sensible values.
· Prints the date in a proper format.
· A function that overloads the == operator as a member function.
· A function that overloads the == operator as a non-member function.
In the main function:
· Define 2 objects with different dates.
· Print the dates.
· Apply the above defined 2 functions for == to compare the above defined dates and print “The dates are similar” or “The dates are different” accordingly.
· Assign the second date to the first date, print the dates, and compare them again by repeating the previous step.