Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,200 --> 00:00:07,770
All right, so in this video, this amazing challenge, what we are going to do is to write a function
2
00:00:08,220 --> 00:00:16,410
that receives a date variable representing some given date, OK, based on our previous examples, very
3
00:00:16,410 --> 00:00:16,950
similar.
4
00:00:17,460 --> 00:00:24,130
And these functions should find and print the next day on the calendar.
5
00:00:24,630 --> 00:00:32,370
So if you're a date is something like 1st of October, 2001, let's say that's of a current date.
6
00:00:32,700 --> 00:00:44,640
Current date is simply like, I don't know, first of October, October 2001, then the printed result,
7
00:00:44,670 --> 00:00:53,840
the next date, the printed result should be should be something like 2nd of October, 2001.
8
00:00:54,210 --> 00:01:02,940
And while that's very simple, there are some cases that students find it hard to make this program
9
00:01:02,940 --> 00:01:04,380
and to answer this challenge.
10
00:01:04,890 --> 00:01:14,070
So my task to you guys, my request is before you move on and like view the whole solution that I'm
11
00:01:14,070 --> 00:01:21,870
giving to you, stop this video, take 20, 30 minutes, try try to write this program on your own.
12
00:01:22,170 --> 00:01:29,340
And once you are ready, once you are done, proceed with this video and make sure and see where you
13
00:01:29,340 --> 00:01:34,890
did one thing and I did another thing and trying to understand where is the difference.
14
00:01:35,310 --> 00:01:41,460
And if everything works correctly, then I think you are proceeding very well.
15
00:01:41,550 --> 00:01:49,350
And if not, make your notes, write your remarks and try on practicing even further.
16
00:01:49,380 --> 00:01:50,550
All right.
17
00:01:51,000 --> 00:01:51,830
Okay.
18
00:01:51,840 --> 00:01:53,220
And now I help.
19
00:01:53,220 --> 00:01:58,130
You are back and you are full of energy and you gave it a shot on your own.
20
00:01:58,380 --> 00:02:05,630
So what we want to do right now, I will still leave everything that I've created previously, the type
21
00:02:05,790 --> 00:02:11,820
struck date, as well as the print, the function, as well as the input date that is responsible for
22
00:02:11,820 --> 00:02:13,620
getting an input from the user.
23
00:02:14,100 --> 00:02:22,920
And what I'm going to use in the main function is simply, let's say, to create a new date.
24
00:02:23,040 --> 00:02:23,940
Simple as that.
25
00:02:24,270 --> 00:02:26,520
And what will be the type of this function?
26
00:02:26,540 --> 00:02:30,330
So first of all, let's say that the type of this function will be void.
27
00:02:30,600 --> 00:02:36,990
So void prefect's date, date DETI, for example, we're receiving a date variable.
28
00:02:37,770 --> 00:02:43,620
Now, what we have to do is to think about the logic behind the scenes as to how to find the next day.
29
00:02:43,800 --> 00:02:52,710
And it's and also taking into account that all of these days that all of these days may also come to
30
00:02:52,710 --> 00:02:57,390
this point thirty one, twelve months and the year and so on.
31
00:02:57,450 --> 00:03:05,490
OK, so the first thing that we have to do is to use something like that date day equals D.T., Dotti
32
00:03:05,910 --> 00:03:06,910
plus one.
33
00:03:06,960 --> 00:03:09,330
OK, we are incrementing just by one.
34
00:03:09,330 --> 00:03:13,650
So deti dot day plus plus would also work here.
35
00:03:13,680 --> 00:03:16,950
OK, and now we are going to ask a simple question.
36
00:03:18,210 --> 00:03:19,170
So awesome.
37
00:03:19,350 --> 00:03:23,100
I think that now we've managed to cover everything here.
38
00:03:23,220 --> 00:03:29,310
Also guys know that there are a lot of a couple actually of ways to solve this exercise.
39
00:03:29,340 --> 00:03:38,660
Also by taking into account the exact month of like month that have 30 days and months and months,
40
00:03:38,670 --> 00:03:40,500
that they have thirty one days.
41
00:03:40,680 --> 00:03:47,670
But the function itself simply will be a little bit longer and you will simply have to use now probably
42
00:03:47,670 --> 00:03:54,210
the best way will be to use switch cases and to like take January as having thirty one days and then
43
00:03:54,480 --> 00:03:58,170
taking the next month, thirty and so on, so forth.
44
00:03:58,170 --> 00:04:03,150
And you know, like taking into account that they are maybe once in four years.
45
00:04:03,150 --> 00:04:03,530
Right.
46
00:04:03,540 --> 00:04:07,110
Twenty eight and twenty nine days in February and so on.
47
00:04:07,560 --> 00:04:10,860
But that's not something that we are going to do right now.
48
00:04:11,160 --> 00:04:18,000
What we wanted just to see what kind of logic of how you find out and print the next day.
49
00:04:18,270 --> 00:04:27,870
And last thing do we have to add here is like something like that or print f the next day is OK and
50
00:04:27,870 --> 00:04:34,550
you simply print use the function print date to print our ADT, our outdated date.
51
00:04:34,560 --> 00:04:36,820
And there you go.
52
00:04:37,500 --> 00:04:40,770
So guys, run this program on your own.
53
00:04:41,160 --> 00:04:42,090
Take some notes.
54
00:04:42,240 --> 00:04:42,700
Right.
55
00:04:42,720 --> 00:04:47,220
And let me know if everything works for you correctly.
56
00:04:47,220 --> 00:04:55,050
If you have managed to make this exercise successfully on your own, if you found this information useful.
57
00:04:55,260 --> 00:04:59,580
And also what I wish you, as always, have a great day and.
58
00:04:59,680 --> 00:05:02,500
Keep on practicing, I'll see you next time.
5956
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.