Skip to content

Commit 77a4a8b

Browse files
authored
Fix tip rendering in README (#3)
1 parent 1889e6e commit 77a4a8b

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

README.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,36 +47,36 @@ implementing two additional scenarios:
4747
You may need to add a `date` field to the `Expense` class to support this
4848
requirement. The date should be the date when the expense occurred.
4949

50-
> [!NOTE]
51-
>
52-
> You can use the `std::tm` type in C++ to work with dates, and you
53-
> can determine if a date is a weekend by using the following function:
54-
>
55-
> ```cpp
56-
> #include <ctime>
57-
> #include <iomanip>
58-
> #include <iostream>
59-
> #include <string>
60-
>
61-
> bool is_weekend(const std::string& date_str)
62-
> {
63-
> std::tm date{};
64-
> std::istringstream ss(date_str);
65-
> ss >> std::get_time(&date, "%Y-%m-%d");
66-
> std::mktime(&date);
67-
>
68-
> int day_of_week = date.tm_wday;
69-
> // Check if it's Saturday (6) or Sunday (0)
70-
> return day_of_week == 6 || day_of_week == 0;
71-
> }
72-
>
73-
> int main()
74-
> {
75-
> std::string date_str = "2023-06-17"; // this is a Saturday
76-
> std::cout << is_weekend(date_str) << std::endl; // this should print: 1
77-
> return 0;
78-
> }
79-
> ```
50+
> [!TIP]
51+
>
52+
> You can use the `std::tm` type in C++ to work with dates, and you
53+
> can determine if a date is a weekend by using the following function:
54+
>
55+
> ```cpp
56+
> #include <ctime>
57+
> #include <iomanip>
58+
> #include <iostream>
59+
> #include <string>
60+
>
61+
> bool is_weekend(const std::string& date_str)
62+
> {
63+
> std::tm date{};
64+
> std::istringstream ss(date_str);
65+
> ss >> std::get_time(&date, "%Y-%m-%d");
66+
> std::mktime(&date);
67+
>
68+
> int day_of_week = date.tm_wday;
69+
> // Check if it's Saturday (6) or Sunday (0)
70+
> return day_of_week == 6 || day_of_week == 0;
71+
> }
72+
>
73+
> int main()
74+
> {
75+
> std::string date_str = "2023-06-17"; // this is a Saturday
76+
> std::cout << is_weekend(date_str) << std::endl; // this should print: 1
77+
> return 0;
78+
> }
79+
> ```
8080
8181
## Prerequisites
8282

0 commit comments

Comments
 (0)