Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,270 --> 00:00:01,650
What is going on, guys?
2
00:00:01,680 --> 00:00:04,900
You're an Alphatech C programming chorus.
3
00:00:05,130 --> 00:00:12,330
And in this video, we are going briefly to go over the implementation of our last example, where we
4
00:00:12,330 --> 00:00:18,390
discussed how we are going to find the maximum between given two numbers.
5
00:00:18,570 --> 00:00:26,070
So, first of all, as usual, we start with adding the includes, then add the end main section, your
6
00:00:26,070 --> 00:00:29,430
entry point, create two variables, number one.
7
00:00:29,490 --> 00:00:33,390
And number two, to hold the values read from the user.
8
00:00:33,540 --> 00:00:37,150
Then we should print some guiding message for the user.
9
00:00:37,170 --> 00:00:41,820
That will help him in understanding exactly what he should do.
10
00:00:42,570 --> 00:00:50,310
And now we are going to read these two values, one off through the other two years to scan our functions.
11
00:00:50,490 --> 00:00:58,020
When the first one reads the value for NUM one and the second scan of functions for SCANA function for
12
00:00:58,020 --> 00:00:58,850
number two.
13
00:00:59,010 --> 00:01:01,060
And now we use our condition.
14
00:01:01,170 --> 00:01:04,410
If no one is greater than NUM two.
15
00:01:04,680 --> 00:01:08,930
And if that's the case, we know that no one will hold the maximum.
16
00:01:08,940 --> 00:01:09,290
Right.
17
00:01:09,600 --> 00:01:12,000
That's why we should print its value.
18
00:01:12,120 --> 00:01:21,010
So we simply use the print F and we just specify Max equals two percentage D and instead of percentage
19
00:01:21,010 --> 00:01:27,570
D. We know that it will be replaced by the value of NUM one, which is in this case the maximum value.
20
00:01:27,690 --> 00:01:36,300
Otherwise else we will print the value of NUM two because we know that definitely num one is not greater
21
00:01:36,300 --> 00:01:38,040
than num two in this case.
22
00:01:38,220 --> 00:01:42,030
And at the end of course, we will specify the return zero.
23
00:01:42,330 --> 00:01:49,650
That simply tells that our program has been terminated successfully to the operating system.
24
00:01:49,740 --> 00:01:50,370
All right.
25
00:01:50,550 --> 00:01:53,190
So I hope this structure is clearer to you guys.
26
00:01:53,400 --> 00:02:00,840
And now I want us to go over the flow of the code line by line, exactly as we've seen it previously,
27
00:02:01,170 --> 00:02:06,780
to see the exact commands that are being executed for the two different examples.
28
00:02:06,960 --> 00:02:11,130
So all the lines of code until the condition are nothing special.
29
00:02:11,430 --> 00:02:15,720
We already know exactly how to do them and how to write them.
30
00:02:15,750 --> 00:02:16,890
Nothing special here.
31
00:02:17,430 --> 00:02:23,820
So let's just assume that no one in this case will be down and NUM two will be five.
32
00:02:24,150 --> 00:02:24,660
OK.
33
00:02:24,840 --> 00:02:28,830
Meaning that there will be two variables behind the scenes.
34
00:02:28,860 --> 00:02:29,430
Number one.
35
00:02:29,430 --> 00:02:30,150
And number two.
36
00:02:30,150 --> 00:02:35,250
And number one will hold the value of ten and num two will hold the value of five.
37
00:02:35,400 --> 00:02:42,810
And now let us use the condition and check if the value in variable on NUM one is actually greater than
38
00:02:43,020 --> 00:02:43,440
two.
39
00:02:43,590 --> 00:02:47,880
So if that's the case, we are going to execute this line of code.
40
00:02:48,000 --> 00:02:54,030
And basically, once we've executed this command, we are going to skip the yellow part and just return
41
00:02:54,030 --> 00:02:55,710
zero as we always do.
42
00:02:55,860 --> 00:02:58,980
And we can actually say that that see it.
43
00:02:59,190 --> 00:03:01,110
Your program found out.
44
00:03:01,230 --> 00:03:02,400
What is the maximum.
45
00:03:02,430 --> 00:03:07,620
Between these two values when the result of the condition was true.
46
00:03:07,920 --> 00:03:08,340
All right.
47
00:03:08,370 --> 00:03:09,260
Good job, guys.
48
00:03:09,290 --> 00:03:11,040
I hope you keep up with the pace.
49
00:03:11,430 --> 00:03:18,390
I tried to summarize this topic, but yet to give you a lot of details, a lot of information and to
50
00:03:18,390 --> 00:03:26,670
go out with you line by line and show you actually how these conditions are actually executed.
51
00:03:26,700 --> 00:03:27,930
Behind the scenes.
52
00:03:28,050 --> 00:03:29,820
So I hope you're with me on that.
53
00:03:29,910 --> 00:03:38,820
So just to summarize all of these execution, if we viewers to numbers five and seven, then these message
54
00:03:38,820 --> 00:03:42,480
of marks equals to seven will be printed on the screen.
55
00:03:42,630 --> 00:03:46,080
And now let's see the flow of the program with the value of NUM.
56
00:03:46,110 --> 00:03:49,740
One is not greater than the value of number two.
57
00:03:49,890 --> 00:03:53,250
So the steps are pretty much the same as previously.
58
00:03:53,370 --> 00:04:00,990
Starting at the main reading, the values from the user, let's say that here the first value will be,
59
00:04:01,680 --> 00:04:08,310
let's say three, which will be stored in NUM one and the second value will be five, which will be
60
00:04:08,310 --> 00:04:09,870
stored in two.
61
00:04:10,050 --> 00:04:11,940
So now the result of the condition.
62
00:04:12,030 --> 00:04:17,380
If no one is greater than NUM two, we'll be false in such a case.
63
00:04:17,400 --> 00:04:17,760
Right.
64
00:04:17,910 --> 00:04:23,460
And if it's false, if it's false, that means we go through the yellow section right away.
65
00:04:23,610 --> 00:04:26,490
We simply skip the previous print f right.
66
00:04:26,520 --> 00:04:31,800
Because it relates thirith situation where and the condition was true.
67
00:04:31,950 --> 00:04:40,020
So now we should simply execute these particular print F and just specify that Max equals two percentage
68
00:04:40,050 --> 00:04:47,280
D and give the value of NUM two, because we know that currently number one is not greater than NUM
69
00:04:47,280 --> 00:04:47,610
two.
70
00:04:47,640 --> 00:04:50,130
That's why we came here to the yellow section.
71
00:04:50,270 --> 00:04:51,180
And there you go.
72
00:04:51,330 --> 00:04:53,610
You can try running this code on your own.
73
00:04:53,820 --> 00:04:55,320
Use a couple of example.
74
00:04:55,320 --> 00:04:57,570
Use a couple of different values.
75
00:04:57,600 --> 00:04:59,120
Just play with it a little.
76
00:04:59,310 --> 00:04:59,910
Make sure.
77
00:05:00,050 --> 00:05:03,590
That everything works just as you've expected it to work.
78
00:05:03,710 --> 00:05:11,150
And also tried to check and understand what will happen, what part of the code will run, and basically
79
00:05:11,150 --> 00:05:15,570
why, if the user uses two numbers, which are the same.
80
00:05:15,590 --> 00:05:17,960
For example, five and five.
81
00:05:18,050 --> 00:05:20,600
So, as always, thank you guys for watching.
82
00:05:21,050 --> 00:05:23,540
And I'll see you in the next video.
7561
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.