All language subtitles for 6. Print X Shape - Solution

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,960 --> 00:00:06,840 So welcome back to the solutions of the EGS shape exercise. 2 00:00:07,380 --> 00:00:15,540 And in this video, what we are going to do is simply to talk and explain how this shape can be printed 3 00:00:15,540 --> 00:00:18,670 by using our C programming language. 4 00:00:19,260 --> 00:00:25,890 So I hope you're excited, at least at least a little bit, OK, because this exercise is actually very 5 00:00:25,890 --> 00:00:27,180 interesting in the concept. 6 00:00:27,180 --> 00:00:34,560 And the approach here is not so trivial because a lot of students at the beginning of their career are 7 00:00:34,590 --> 00:00:39,630 requested to make this exercise, or at least very similar exercises. 8 00:00:39,990 --> 00:00:42,670 And they are kind of getting stuck on this one. 9 00:00:43,140 --> 00:00:50,150 So let's talk about how we in me and you should approach these kind of exercises. 10 00:00:50,550 --> 00:00:57,300 And basically, I would like to know if any of you guys succeeded to bring this on your first attempt 11 00:00:57,510 --> 00:01:04,410 when your second attempt or maybe you got, for example, stuck and you are looking at this video to 12 00:01:04,410 --> 00:01:06,920 understand how it should be done. 13 00:01:07,380 --> 00:01:12,210 So without further ado, let's start working. 14 00:01:12,930 --> 00:01:19,470 And the first question is basically, how should we treat to this exercise how we should even start 15 00:01:19,470 --> 00:01:20,190 using it? 16 00:01:20,760 --> 00:01:29,550 So one of the options here is simply to understand that we cannot print this whole thing just by using 17 00:01:30,750 --> 00:01:37,670 one print offline and without specifying some condition, not conditions, but some logic behind it. 18 00:01:37,680 --> 00:01:37,920 Right. 19 00:01:37,930 --> 00:01:40,590 We can simply say something like this. 20 00:01:40,590 --> 00:01:43,620 Print F, big X, right. 21 00:01:43,890 --> 00:01:45,150 It's not going to work. 22 00:01:45,150 --> 00:01:48,590 It's not going to bring this like this pattern. 23 00:01:48,600 --> 00:01:57,270 But what we have to do is, first of all, try to break what we see here to a couple of rows in a couple 24 00:01:57,270 --> 00:01:58,020 of columns. 25 00:01:58,950 --> 00:02:04,590 So first of all, what I can see here is once again, that's a pattern, right? 26 00:02:04,740 --> 00:02:10,350 Just like we've seen probably in previous exercises, it simply prints asterisks. 27 00:02:10,350 --> 00:02:13,650 And here we have some blank space. 28 00:02:14,250 --> 00:02:22,110 And what you have to understand is that this blank space is not actually so blank, these space blank 29 00:02:22,110 --> 00:02:28,020 space, it consists of simply using space characters. 30 00:02:28,070 --> 00:02:29,370 OK, so it's not empty. 31 00:02:29,370 --> 00:02:31,010 It's not some void area. 32 00:02:31,020 --> 00:02:36,240 It simply consists of printing the space and then printing another space in another space. 33 00:02:36,720 --> 00:02:39,840 So here we have five spaces printed to the screen. 34 00:02:40,140 --> 00:02:43,840 Here we have three spaces, one space, and that's it. 35 00:02:44,460 --> 00:02:50,310 So that's the first know that you have to understand about this exercise is probably we are going to 36 00:02:50,310 --> 00:02:57,070 use your spaces in some constructions with these spaces in order to print all of these shape. 37 00:02:57,840 --> 00:03:06,150 And the second thing that you have to understand here is that we are simply going to take like to take 38 00:03:06,480 --> 00:03:10,340 into consideration the rows and the columns. 39 00:03:10,890 --> 00:03:17,460 So we are going to print first of all, our first attempt is going to be to print these little nice, 40 00:03:17,850 --> 00:03:22,500 nice small leaks that consists of three rows and three columns. 41 00:03:22,500 --> 00:03:22,810 Right. 42 00:03:22,830 --> 00:03:26,950 So that's the first shape that I want us to try print to the screen. 43 00:03:26,980 --> 00:03:27,450 This one. 44 00:03:28,850 --> 00:03:35,210 So the approach is very simple, what we should do simply is printing OK, and in this first print of 45 00:03:35,210 --> 00:03:43,790 command we are going to print the first line in the first line consists of Starbright space and a star. 46 00:03:44,060 --> 00:03:44,330 Right. 47 00:03:44,330 --> 00:03:51,850 We can see Star Space Star, then we have a backslash and simply to go on line to the next line. 48 00:03:52,190 --> 00:03:59,180 So then we have another print F and what these print F consists of, it consists of just one star. 49 00:03:59,930 --> 00:04:06,080 And also the last line consists of pretty much the same. 50 00:04:06,080 --> 00:04:06,510 Right. 51 00:04:06,530 --> 00:04:09,230 That's this this line and this line. 52 00:04:09,380 --> 00:04:11,970 They are both identical, kind of identical. 53 00:04:12,620 --> 00:04:13,730 So there you go. 54 00:04:13,730 --> 00:04:15,390 You have your figure. 55 00:04:15,410 --> 00:04:20,120 So let's try to build and run it and see if it works exactly as we expected. 56 00:04:21,140 --> 00:04:28,850 OK, so that's that's what happens, guys, because we have a star in space and a star, so a star space 57 00:04:28,850 --> 00:04:29,410 and a star. 58 00:04:29,690 --> 00:04:31,430 And here we have just one star. 59 00:04:31,610 --> 00:04:31,940 Right. 60 00:04:31,970 --> 00:04:33,410 But what's the problem? 61 00:04:33,410 --> 00:04:41,270 The problem is that if we look at this shape, we can see that if we are looking at it in kind of a 62 00:04:41,270 --> 00:04:50,300 rectangle format, then before these little nice asterisk, we have a space. 63 00:04:50,300 --> 00:04:50,770 Right. 64 00:04:51,050 --> 00:04:54,680 So that's something we didn't take into account. 65 00:04:54,680 --> 00:04:59,480 And that's why it was not printed in the middle, as we would have expected. 66 00:05:00,020 --> 00:05:05,440 So let's simply just add a space here before and maybe also a space after. 67 00:05:05,720 --> 00:05:06,380 And there you go. 68 00:05:06,380 --> 00:05:14,330 You can see also right here in the print of comments that the shape is starting to get kind of similar 69 00:05:14,540 --> 00:05:16,330 shape to what we wanted. 70 00:05:16,640 --> 00:05:21,980 So let's build and run it and we can see that that's exactly the small shape that we wanted to print. 71 00:05:22,760 --> 00:05:23,290 Awesome. 72 00:05:23,300 --> 00:05:25,700 So that's kind of works. 73 00:05:27,200 --> 00:05:30,920 And now what we have to do is simply to expand it a little bit further. 74 00:05:30,980 --> 00:05:35,260 So let's take it right here and also take this one right here. 75 00:05:35,270 --> 00:05:40,280 So I'm doing this because that's how I requested you to approach this exercise. 76 00:05:40,280 --> 00:05:46,970 And first of all, to print a small rectangle, a small X and then some larger X and then the large 77 00:05:46,970 --> 00:05:49,110 one that we wanted initially. 78 00:05:49,610 --> 00:05:53,780 So what we have to do now is simply to print this additional line before. 79 00:05:53,870 --> 00:05:54,180 Right. 80 00:05:54,200 --> 00:05:55,660 So it's going to be printed out. 81 00:05:56,060 --> 00:05:59,960 And here we have star and one to three spaces. 82 00:05:59,960 --> 00:06:03,590 So star one, two, three star and resolution. 83 00:06:04,100 --> 00:06:07,690 And that's the same line that we added to the end of the sixth shape. 84 00:06:07,700 --> 00:06:09,380 So print f star. 85 00:06:09,410 --> 00:06:10,780 OK, so there you go. 86 00:06:11,660 --> 00:06:18,410 And what you can notice here is that if you take a look at this shape, you can see that it's not similar 87 00:06:18,410 --> 00:06:19,250 to these six. 88 00:06:19,250 --> 00:06:19,590 Right. 89 00:06:19,610 --> 00:06:26,480 And if you build and run it, you will also see that you get some sort of strange Kelaher. 90 00:06:26,480 --> 00:06:26,720 Right. 91 00:06:26,720 --> 00:06:27,650 But not an X. 92 00:06:28,310 --> 00:06:35,350 So what do we have to do is simply to understand that previously we didn't use in this line any space 93 00:06:35,390 --> 00:06:35,930 before. 94 00:06:36,140 --> 00:06:43,090 But since we've expanded this exercise, we have now to use a space before this line. 95 00:06:43,100 --> 00:06:46,940 So that's going to be one space and that's going to be one space. 96 00:06:47,420 --> 00:06:54,330 And also before the middle the middle asterisk, what do we have to do is to add additional space. 97 00:06:54,890 --> 00:06:59,990 So now it's trying to kind of look looks like we want it to. 98 00:06:59,990 --> 00:07:00,260 Right. 99 00:07:00,260 --> 00:07:01,330 So build and run it. 100 00:07:01,790 --> 00:07:02,600 And there you go. 101 00:07:02,630 --> 00:07:04,360 You've created your X. 102 00:07:05,300 --> 00:07:12,050 So what we've done once again was simply we simply noticed that previously the shape that we've printed, 103 00:07:12,050 --> 00:07:15,700 the small shape, are in the first and last lines. 104 00:07:15,710 --> 00:07:22,010 And it all you didn't have any spaces before, but now since we expanded it. 105 00:07:22,160 --> 00:07:22,550 Right. 106 00:07:22,570 --> 00:07:29,330 So if we look at this rectangle shape, we know that here should be something right here should be some 107 00:07:29,330 --> 00:07:29,930 space. 108 00:07:30,380 --> 00:07:32,960 So that's why we added a space here in a space here. 109 00:07:33,180 --> 00:07:40,670 And also we noticed that now in order to keep this star in the middle, we need to add beforehand two 110 00:07:40,970 --> 00:07:41,670 spaces. 111 00:07:41,700 --> 00:07:49,070 OK, so if we don't specify exactly afterwords, also two spaces in one space here in one space here, 112 00:07:49,640 --> 00:07:51,830 it really doesn't matter because. 113 00:07:52,160 --> 00:08:00,030 Well, anyway, we simply just get one line, one line ahead by using these backslash M. 114 00:08:00,890 --> 00:08:02,500 So I hope that's clear so far. 115 00:08:02,510 --> 00:08:05,950 And finally, let's add of the last line, which is this one. 116 00:08:05,960 --> 00:08:08,900 So one and two. 117 00:08:09,290 --> 00:08:09,770 Right. 118 00:08:09,780 --> 00:08:10,940 That's how we do it. 119 00:08:11,420 --> 00:08:15,450 And just expand, expand, expanded a little bit further. 120 00:08:15,450 --> 00:08:25,880 And so printf in here we have asterisk and asterisk and one, two, three, four, five, five spaces. 121 00:08:25,880 --> 00:08:27,290 One, two, three, four, five. 122 00:08:28,120 --> 00:08:33,560 Risk explosion and also add this line to the end. 123 00:08:34,450 --> 00:08:41,680 And one thing that we have to remember for these kind of things is simply to move once base all of these 124 00:08:41,680 --> 00:08:46,380 characters that were previously so one one, one, one and one. 125 00:08:46,990 --> 00:08:48,760 And basically there you go. 126 00:08:48,760 --> 00:08:52,150 You got your X shape printed to the screen. 127 00:08:52,420 --> 00:08:58,350 And you also understand the main logic behind it, how to approach it, how to tackle this problem. 128 00:08:58,360 --> 00:09:04,320 Basically, most of the things you need to print, most of the shapes that you want. 129 00:09:04,330 --> 00:09:08,780 So if you want to print any other letters, so give it a shot to give it a try. 130 00:09:09,190 --> 00:09:15,040 I think that there should be no problems, no actual problems, at least for you. 131 00:09:15,040 --> 00:09:21,100 Once you understand the concept of using rows and columns and understanding the spaces and to start 132 00:09:21,100 --> 00:09:23,890 with some smaller figure, for example. 133 00:09:24,700 --> 00:09:25,930 And yeah. 134 00:09:26,320 --> 00:09:30,550 So I hope you like this video and I'll see you in the next one. 12554

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.