From ec7af872b1647719f011276665ef9ce4840bc137 Mon Sep 17 00:00:00 2001 From: Rudi Buss <rudi.buss@th-deg.de> Date: Thu, 26 Sep 2024 19:40:12 +0200 Subject: [PATCH] Update Exercise 3 - Date.txt --- .../Exercises/Exercise 3 - Date.txt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Part 2/6. Operator overloading/Exercises/Exercise 3 - Date.txt b/Part 2/6. Operator overloading/Exercises/Exercise 3 - Date.txt index 7c2126a..5771f68 100644 --- a/Part 2/6. Operator overloading/Exercises/Exercise 3 - Date.txt +++ b/Part 2/6. Operator overloading/Exercises/Exercise 3 - Date.txt @@ -1 +1,16 @@ -Create a class ÒDateÒ which has the data members Day, Month and Year. Overload the input operator. Fill the three data members via the keyboard. Check the following: - The value for the month must be between 1 and 12 - The value for the day must be greater than or equal to 1 - The maximum value of the day depends on the month: - January, March, May, July, August, October, December have a max. of 31 days - April, June, September, November have a max. of 30 days - February has a max. of 28 days (leap year is not checked) - The year must not be negative The input is to be made until a correct value has been entered. Overload the output operator. Output the date in the following form: DD.MM.YYYYY \ No newline at end of file +Create a class "Date" which has the data members Day, Month and Year. + +Overload the input operator. Fill the three data members via the keyboard. + +Check the following: +- The value for the month must be between 1 and 12 +- The value for the day must be greater than or equal to 1 +- The maximum value of the day depends on the month: + - January, March, May, July, August, October, December have a max. of 31 days + - April, June, September, November have a max. of 30 days + - February has a max. of 28 days (leap year is not checked) +- The year must not be negative + +The input is to be made until a correct value has been entered. + +Overload the output operator. Output the date in the following form: DD.MM.YYYYY -- GitLab