1
00:00:00,120 --> 00:00:00,490
OK.

2
00:00:00,570 --> 00:00:01,530
Hello, everybody.

3
00:00:02,190 --> 00:00:04,200
Welcome to another lecture.

4
00:00:04,230 --> 00:00:06,890
Today's lecture is going to be the big one.

5
00:00:06,900 --> 00:00:10,590
We are going to write our first C++ program.

6
00:00:11,100 --> 00:00:19,000
It's also going to be a lecture that kind of combines the first time we are going to use the vs code

7
00:00:19,030 --> 00:00:20,430
lightweight text editor.

8
00:00:20,440 --> 00:00:26,490
So whatever lightweight text editor that you might want to use, this video is kind of going to be about

9
00:00:26,490 --> 00:00:27,540
that as well.

10
00:00:27,720 --> 00:00:33,900
And it's going to be a Windows kind of themed version rather than Linux or Mac, but we're going to

11
00:00:34,050 --> 00:00:35,220
try and cover all of those.

12
00:00:35,220 --> 00:00:40,670
Don't worry, there will be a video for your operating system and the type of editor you want to use.

13
00:00:40,680 --> 00:00:41,880
We're going to cover.

14
00:00:41,880 --> 00:00:48,020
I think I'm reiterating this, but it will be kind of we'll go over a lightweight text editor like VSCO.

15
00:00:48,030 --> 00:00:53,340
We will go over a big, robust all the bells and whistles, integrated development environment like

16
00:00:53,340 --> 00:00:54,150
sea lion.

17
00:00:55,050 --> 00:01:00,060
And then we will also go over command line based editors like them.

18
00:01:00,660 --> 00:01:06,480
So we'll go over those three things so you can code C++ in whatever environment you want.

19
00:01:06,930 --> 00:01:17,250
If you are watching this video right now and you do not have a C++ compiler installed, please go back

20
00:01:17,250 --> 00:01:17,370
in.

21
00:01:17,520 --> 00:01:19,620
Yes, this is only if you're on windows.

22
00:01:20,070 --> 00:01:29,040
If you do not have a C++ compiler installed, please go back and watch my men GW installation video

23
00:01:29,490 --> 00:01:40,350
where I tell you how to install a C++ compiler called Manjhi W, which is the minimum new compiler collection

24
00:01:40,350 --> 00:01:41,340
for Windows.

25
00:01:41,850 --> 00:01:45,420
And make sure you get up to speed on that.

26
00:01:45,420 --> 00:01:51,240
So you have something because we are going to need a compiler to compile and run our C++ program today.

27
00:01:52,200 --> 00:01:54,000
So love talking and not doing.

28
00:01:54,000 --> 00:01:54,820
Let me get started.

29
00:01:54,870 --> 00:01:56,820
I'm going to click on this code here.

30
00:01:56,820 --> 00:02:01,950
If you don't have your text editor pinned to the taskbar, just find it and open it up.

31
00:02:03,810 --> 00:02:11,850
So I'm going to go up here to file and new file, so I don't have this untitled one.

32
00:02:12,800 --> 00:02:18,680
We get rid of that, and I'm going to click select a language and say this up here.

33
00:02:19,890 --> 00:02:23,370
And I'm going to go down here and choose C++.

34
00:02:24,660 --> 00:02:29,130
The reason I did that is because text editors actually have a great feature.

35
00:02:29,190 --> 00:02:37,380
Pretty much all of them where they color code the syntax for C++.

36
00:02:37,380 --> 00:02:45,150
So when you're typing code, the differences and the keywords and things that you are typing will lead

37
00:02:45,150 --> 00:02:49,350
to it being color different, and that makes it very nice and readable.

38
00:02:49,710 --> 00:02:54,090
And I think that you'll probably enjoy a certain color schemes better than others.

39
00:02:54,570 --> 00:02:59,370
And in the future, I might show you how to adjust those color schemes and things to your liking.

40
00:03:01,070 --> 00:03:07,070
So another thing I want to say is that this is going to have a ton of information, I know I kind of

41
00:03:07,070 --> 00:03:13,490
said that before, but this video is just going to drop all kinds of stuff right off the bat, which

42
00:03:13,490 --> 00:03:16,610
is not something I want to do, but it's something we got to do.

43
00:03:17,340 --> 00:03:24,830
We need to have some type of basic program just to show you that C++ can do something.

44
00:03:25,790 --> 00:03:30,500
And later, we're going to go into all of the pieces of this program that we write today.

45
00:03:30,500 --> 00:03:36,680
So the things that I say today, just take it with a grain of salt, but know that everything that I

46
00:03:36,680 --> 00:03:42,980
write down here is kind of like what you need to get the most basic program up and running, and that

47
00:03:42,980 --> 00:03:46,700
is going to be the ever so cliche Hello World program.

48
00:03:46,700 --> 00:03:51,740
Some of you might have heard about that if you've done any other coding in any other language before.

49
00:03:51,980 --> 00:03:56,270
Most of the time, the first program that everyone makes is something called Hello World, where it

50
00:03:56,270 --> 00:04:00,350
just prints those words Hello world to a console.

51
00:04:00,920 --> 00:04:03,080
So we are going to have a console here.

52
00:04:03,080 --> 00:04:09,440
A console is just basically something at the bottom of the screen that shows the output of a program.

53
00:04:09,800 --> 00:04:17,510
It might also include errors that get output it if there is a problem with the compilation process or

54
00:04:17,510 --> 00:04:20,060
a runtime error or something like that.

55
00:04:20,780 --> 00:04:22,850
So, yeah, that's what a console is.

56
00:04:22,850 --> 00:04:29,000
We're going to be using the term run all the integrated Terminal four vs code for that later on.

57
00:04:29,300 --> 00:04:31,550
But first off, let's write our code right.

58
00:04:33,140 --> 00:04:40,400
So I'm going to give a brief explanation of each line in this code, but it's going to be like a very

59
00:04:40,400 --> 00:04:47,630
kind of abstracted explanation, a very high level view explanation of what is really going on.

60
00:04:47,660 --> 00:04:54,020
So if there's some of you out there that already know about this stuff a little bit, yet you're still

61
00:04:54,020 --> 00:04:59,840
watching this video and you're just like, Oh, that's not true what you said, it's a lot more to it

62
00:04:59,840 --> 00:05:01,270
than that then.

63
00:05:01,280 --> 00:05:06,560
Yeah, you know, I'm just kind of explaining it in a super layman's terms way, just so you can have

64
00:05:06,560 --> 00:05:12,170
a general idea of why the heck, we're writing so much code just to print the words Hello world.

65
00:05:12,920 --> 00:05:14,090
So with that, let me get started.

66
00:05:14,480 --> 00:05:19,040
I'm going to put this hashtag symbol here, and I'm going to write the word include.

67
00:05:19,460 --> 00:05:27,670
And then a less than sign, then the word I'll stream and a closing sign here.

68
00:05:27,680 --> 00:05:30,320
So I had the less than sign than a greater than sign here.

69
00:05:30,500 --> 00:05:31,130
To close it.

70
00:05:33,270 --> 00:05:34,350
So what is this?

71
00:05:34,650 --> 00:05:40,830
Well, all you need to know about this right now is that it's including something, right and it has

72
00:05:40,830 --> 00:05:41,550
a hashtag.

73
00:05:41,700 --> 00:05:45,180
You need to put a hashtag before you add the word include in C++.

74
00:05:46,170 --> 00:05:51,540
And what is it including in our program is including something called extreme before these less than

75
00:05:51,540 --> 00:05:52,420
greater than science?

76
00:05:52,440 --> 00:05:59,940
What is extreme extreme is basically a toolbox that lets us use some things to print stuff to the console,

77
00:05:59,940 --> 00:06:01,330
which is what we want to do, right?

78
00:06:01,350 --> 00:06:04,350
We want to print the words Hello world to the console.

79
00:06:04,890 --> 00:06:10,440
It stands for input output stream, and we will be using a lot of streams later on in the course not

80
00:06:10,440 --> 00:06:13,110
just input output stream, but file streams as well.

81
00:06:13,110 --> 00:06:18,300
Where we put stuff in files, we write stuff to files and read stuff from files.

82
00:06:19,140 --> 00:06:21,180
So just a little heads up on that.

83
00:06:21,190 --> 00:06:23,490
That's what we're going to be doing later with some streams.

84
00:06:24,420 --> 00:06:25,400
Very common thing.

85
00:06:25,410 --> 00:06:27,570
You almost always want to include this in your program.

86
00:06:27,570 --> 00:06:34,620
As you'll see, it helps a lot with certain types of debugging and caching errors and stuff.

87
00:06:36,810 --> 00:06:44,760
So the next thing that I am a type is not necessary to make the program work, but I'm going to type

88
00:06:44,760 --> 00:06:47,580
it anyways because it lets us write a little bit less code.

89
00:06:48,330 --> 00:06:50,910
I'm going to say using namespace STD.

90
00:06:51,930 --> 00:07:01,290
And for those experienced C++ developers that have still maybe gotten the course just to go over some

91
00:07:01,290 --> 00:07:02,520
algorithms or something.

92
00:07:04,260 --> 00:07:11,860
This is something I'm just introducing to let people know kind of what it is, we'll be using this namespace

93
00:07:11,880 --> 00:07:17,520
hosted a little bit in the course, but I know that a lot of C++ developers do not like to put this

94
00:07:17,520 --> 00:07:21,980
in their code and for good reason, but we'll go over that later right now.

95
00:07:21,990 --> 00:07:26,160
Just put it in your code if you are just starting out and do not know what all of this already is.

96
00:07:27,090 --> 00:07:34,560
So the next thing that I'm going to do is put it, which stands for integer like a number like two or

97
00:07:34,710 --> 00:07:39,780
five or 100 and then main with some parentheses.

98
00:07:40,680 --> 00:07:45,090
And then I'm going to put one curly brace, but it's going to make two curly braces for me because the

99
00:07:45,090 --> 00:07:46,230
editor is cool like that.

100
00:07:48,190 --> 00:07:58,090
This right here is me defining a function, the function is called main, and this functions thing that

101
00:07:58,090 --> 00:08:00,950
it does could be really anything.

102
00:08:00,970 --> 00:08:03,730
It could be whatever we put in between these curly braces.

103
00:08:04,270 --> 00:08:10,060
But whatever you put before, the name of the function is what the function returns.

104
00:08:10,780 --> 00:08:13,670
So we're going to get into all of this stuff later.

105
00:08:13,690 --> 00:08:17,530
We'll talk a lot about functions, but I just want to give a basic explanation.

106
00:08:18,430 --> 00:08:23,440
When the function returns something, it just means that it's like giving you back something.

107
00:08:23,440 --> 00:08:28,150
You might give it something in that would go in between these parentheses, actually, but we're not

108
00:08:28,150 --> 00:08:29,200
going to do that right now.

109
00:08:30,880 --> 00:08:35,230
I'm going to go in between the curly braces and press the enter key that's going to, like, separate

110
00:08:35,230 --> 00:08:39,910
them nicely and then I can put what I want the function to do here in C++.

111
00:08:40,450 --> 00:08:44,560
We have to make this main function to be able to do some stuff right now.

112
00:08:45,810 --> 00:08:51,450
We could maybe in another programming language only have like one line of code to be able to do what

113
00:08:51,450 --> 00:08:55,980
we want to do right now, but C++ is a little more complex and so we have to write all the stuff.

114
00:08:57,120 --> 00:09:00,750
So now I'm going to use a tool from this little toolbox here.

115
00:09:01,870 --> 00:09:09,310
And it is something called See Out, which just stands for outputting to the console console out is

116
00:09:09,310 --> 00:09:15,250
what you can think of it as not only do I have to put that, but I have to put this thing called the

117
00:09:15,250 --> 00:09:16,360
output operator.

118
00:09:18,200 --> 00:09:22,790
It's like the output stream operator, it's going to be two of these little less than science.

119
00:09:24,620 --> 00:09:29,120
And then after that, I put whatever I want to be printed out to the console.

120
00:09:29,240 --> 00:09:30,800
So we want hello world, right?

121
00:09:31,160 --> 00:09:36,470
So I put hello world after this, I'm going to put another two of these a little less than science.

122
00:09:36,740 --> 00:09:41,140
So another one of these output stream operators, because I don't only want it to just print Hello World,

123
00:09:41,150 --> 00:09:43,370
I also want it to move to the next line.

124
00:09:44,150 --> 00:09:46,640
So to do that, I'm going to put in the line.

125
00:09:46,640 --> 00:09:49,370
So Intel is what you do for line.

126
00:09:51,060 --> 00:09:57,540
And in C++, you for pretty much all of your statements, you will be putting in a semicolon after that.

127
00:09:58,050 --> 00:10:00,840
Sorry, I didn't explain that when I did the using namespace STD.

128
00:10:02,160 --> 00:10:06,720
But that is something that you're going to put at most at the end of most, all of your statements.

129
00:10:07,290 --> 00:10:09,270
You notice there's not one at the end of the function.

130
00:10:09,480 --> 00:10:10,440
That's an exception.

131
00:10:12,830 --> 00:10:18,920
So we have this CEO Hello World now, and then like I said, functions return things.

132
00:10:18,950 --> 00:10:26,570
This returns an integer and it's kind of a convention in C++ to return to zero.

133
00:10:27,710 --> 00:10:29,990
We do not have to do that.

134
00:10:30,560 --> 00:10:31,970
I'm just putting it here.

135
00:10:32,690 --> 00:10:38,550
I will go into this in much more detail later on why we have the return zero.

136
00:10:38,570 --> 00:10:41,930
What really is the main function right now?

137
00:10:42,140 --> 00:10:43,250
You should just know.

138
00:10:43,640 --> 00:10:50,660
The only thing you really need to know is that main is a special name for a function.

139
00:10:51,320 --> 00:10:59,630
C++ recognizes this specific name of this function, and it is like a special function that kind of

140
00:10:59,630 --> 00:11:01,790
like the entry point to our program.

141
00:11:02,850 --> 00:11:07,560
We will be getting lunch into greater detail, like I keep saying on all of this later, but this is

142
00:11:07,560 --> 00:11:10,740
just a basic explanation of why we had to put this stuff here.

143
00:11:11,430 --> 00:11:18,740
We need a function to be able to print something out and we need to return something from the function.

144
00:11:18,750 --> 00:11:25,320
Well, we don't need to, but it's a convention that I'll get into much more later on.

145
00:11:25,950 --> 00:11:28,260
So this is actually kind of complete now.

146
00:11:28,260 --> 00:11:33,900
This is the bare minimum that we're going to be able to do to make this whole world happen.

147
00:11:35,350 --> 00:11:38,320
So with that, what do we do now?

148
00:11:38,440 --> 00:11:39,670
We wrote our code.

149
00:11:40,270 --> 00:11:43,150
You remember what we talked about in the previous lectures.

150
00:11:43,510 --> 00:11:50,290
So once you write your code in some sort of file, then you need to use the compiler to compile the

151
00:11:50,290 --> 00:11:50,750
code.

152
00:11:51,130 --> 00:11:54,230
And once the compiler compiles the code, then you can run the code.

153
00:11:54,250 --> 00:11:55,570
So that's what we're going to do now.

154
00:11:56,290 --> 00:11:59,680
But before we do that, we're going to have to save our files.

155
00:11:59,700 --> 00:12:06,100
So what I'm going to do is I'm going to go to file save as I am in this folder, Dylan, right here.

156
00:12:06,490 --> 00:12:07,860
I'm just going to call this.

157
00:12:07,870 --> 00:12:12,220
I'm going to make a folder called Hello World.

158
00:12:13,030 --> 00:12:14,710
Or actually, it looks at the file.

159
00:12:16,470 --> 00:12:22,380
I'm going to call the file Hello, world that, but I'm not going to need the extension because they

160
00:12:22,380 --> 00:12:23,100
already are.

161
00:12:23,850 --> 00:12:25,310
It's in the same as typed right here.

162
00:12:25,320 --> 00:12:26,580
They to have the extension here.

163
00:12:27,990 --> 00:12:36,120
What I am going to do, though, is I'm actually going to make a new folder, so I'm going to go here

164
00:12:36,120 --> 00:12:41,730
and I'm going to say new folder and just right clicked, and I'm just going to say this call this first

165
00:12:41,790 --> 00:12:42,840
program.

166
00:12:44,940 --> 00:12:45,570
All right.

167
00:12:46,170 --> 00:12:51,840
And I'm going to save our file and here you can save it wherever you would like.

168
00:12:52,110 --> 00:12:58,470
Actually, I am just choosing to make this directory, so I have like a clean directory here.

169
00:12:59,160 --> 00:13:00,920
And so I have my file name here.

170
00:13:00,930 --> 00:13:04,050
Here's the extension I'm going to say save and it's going to save our file.

171
00:13:04,050 --> 00:13:08,910
Then you notice now that it's saved here and it actually shows the path that it was saved in.

172
00:13:08,910 --> 00:13:15,540
So we have a C drive users still in first programs, the folder we made and then our file Hello World

173
00:13:15,540 --> 00:13:16,950
Dot CPP.

174
00:13:17,520 --> 00:13:22,380
I think I mentioned in the previous lecture, but the Dot CPP stands for C++.

175
00:13:22,620 --> 00:13:26,780
It is an extension, a file extension similar to like dot text.

176
00:13:27,660 --> 00:13:31,050
Things like that dot doc x, that good stuff.

177
00:13:31,050 --> 00:13:33,600
So that's what the CPP stands for.

178
00:13:34,470 --> 00:13:36,030
We will see that later on.

179
00:13:36,720 --> 00:13:42,180
There are additional extensions for C++ program files.

180
00:13:42,480 --> 00:13:45,990
So right now, though, we're just doing the CPP file.

181
00:13:47,780 --> 00:13:55,520
So now we need to compile it since I am on a Windows machine and I'm in this code.

182
00:13:55,580 --> 00:14:00,290
I am going to use this integrated terminal.

183
00:14:01,260 --> 00:14:04,740
So I'm going to go up here and say new terminal.

184
00:14:06,100 --> 00:14:11,320
And that brings up this thing down here, which is kind of what you can think of as the console.

185
00:14:11,530 --> 00:14:16,630
This is actually not just a console, though, it is a true terminal.

186
00:14:16,630 --> 00:14:21,460
It's like a command prompt or you can type commands in here, and that's what we're going to do in here

187
00:14:21,460 --> 00:14:21,940
as well.

188
00:14:22,870 --> 00:14:27,820
If you have an integrated development environment that you are doing this tutorial with, like Sea Lion,

189
00:14:28,660 --> 00:14:31,060
it's basically going to be kind of at the bottom of your screen.

190
00:14:31,060 --> 00:14:35,440
Remember that we will go over how to do everything at Sea Lion.

191
00:14:35,440 --> 00:14:41,260
So if you're following this tutorial and it's not really making sense to you, then maybe just kind

192
00:14:41,260 --> 00:14:44,200
of skip ahead to the one where we do it in sea lion.

193
00:14:45,900 --> 00:14:55,710
So we will also be going over this, you know, using the standard command prompt in terminal and using

194
00:14:55,710 --> 00:15:04,740
an editor in there, in which case I will be using a bash shell, a more Linux style shell that will

195
00:15:04,740 --> 00:15:07,500
have similar commands to like if you are on Mac.

196
00:15:08,490 --> 00:15:10,770
So, yeah, just wanted to say that.

197
00:15:11,550 --> 00:15:13,980
So what do we do now?

198
00:15:13,980 --> 00:15:15,020
We got this terminal?

199
00:15:15,030 --> 00:15:19,530
I am not assuming that any of you know how to navigate through the terminal.

200
00:15:19,530 --> 00:15:24,570
If you do, that's a great go to your file and then compile it and run it if you know how to compile

201
00:15:24,570 --> 00:15:24,690
it.

202
00:15:24,690 --> 00:15:29,970
If not, just go to the location of the file and wait there until I get there.

203
00:15:30,960 --> 00:15:34,020
For the people that don't know about how to do that.

204
00:15:34,290 --> 00:15:35,970
I'm going to introduce some commands.

205
00:15:36,930 --> 00:15:45,300
First off, notice that this path appears, says C Drive users Dylan first program Hello World.

206
00:15:45,690 --> 00:15:49,890
We are here, though C Drive users doing so.

207
00:15:49,890 --> 00:15:51,300
We're in this first part.

208
00:15:51,450 --> 00:15:53,520
This is the location that we are in.

209
00:15:55,910 --> 00:15:59,810
We need to navigate to here where our program is, right?

210
00:16:00,230 --> 00:16:01,760
So how do we do that?

211
00:16:02,450 --> 00:16:08,060
We are going to use a command called C, which stands for Change Directory.

212
00:16:08,810 --> 00:16:17,960
After that, you need to type the name of the directory and it has to be a directory that is in this

213
00:16:17,960 --> 00:16:20,570
current folder that you're in.

214
00:16:21,620 --> 00:16:27,290
So what we are going to do is type first program because we noticed that this is the path, right?

215
00:16:27,290 --> 00:16:29,820
First program is inside of Dillon.

216
00:16:29,870 --> 00:16:31,390
Dillon is inside of users.

217
00:16:31,420 --> 00:16:33,650
Users are inside, inside of C Drive.

218
00:16:35,480 --> 00:16:40,080
So the first program is located in the current directory that we are in.

219
00:16:40,100 --> 00:16:43,580
We noticed that the right most thing on this line is Dylan.

220
00:16:43,760 --> 00:16:49,640
And we know that first program is inside of Dylan because it comes directly after Dylan up here.

221
00:16:51,600 --> 00:16:56,910
So you can also double check this by just seeing if it can recognize it, so I started typing.

222
00:16:57,450 --> 00:17:04,440
First program f i r s, then I stop right here, I'm going to press the tab key.

223
00:17:05,670 --> 00:17:11,220
And you notice that it recognized it and completed it and also put the path around it.

224
00:17:11,700 --> 00:17:16,590
So the Dot says current directory, that's what that means.

225
00:17:17,100 --> 00:17:19,440
Then inside the current directory that you're in.

226
00:17:19,740 --> 00:17:24,720
It puts a little slash here and says, OK, first program, that's the directory.

227
00:17:25,140 --> 00:17:26,610
And then it puts another slash here.

228
00:17:27,630 --> 00:17:31,080
So this whole line is going to take us into first program.

229
00:17:31,080 --> 00:17:31,980
So I press enter.

230
00:17:32,730 --> 00:17:39,300
Notice what it says over here on our prompt now it says C users Dylan first program.

231
00:17:39,300 --> 00:17:45,810
Now we are inside of the first program directory that we created, and we know that this is to the right

232
00:17:45,810 --> 00:17:46,550
of first program.

233
00:17:46,560 --> 00:17:48,750
That means that Hello World is in first program.

234
00:17:49,650 --> 00:17:57,930
Now I'm going to show you a way to see what is inside of the directory that you are in in here and that

235
00:17:57,930 --> 00:17:59,190
is using the L.

236
00:17:59,190 --> 00:18:01,090
S Command L.

237
00:18:01,120 --> 00:18:10,220
S stands for list and it will show you all of the other folders and files stored inside of the directory

238
00:18:10,230 --> 00:18:12,170
or in since first program.

239
00:18:12,180 --> 00:18:18,300
It will show us all of the folders and files that are inside of the first program directory.

240
00:18:20,250 --> 00:18:25,290
So I type that and we notice there is this.

241
00:18:25,620 --> 00:18:28,350
Hello, World Cup right here.

242
00:18:29,660 --> 00:18:30,770
You see this right here.

243
00:18:31,460 --> 00:18:32,720
Hello, World Cup.

244
00:18:34,620 --> 00:18:39,990
So what I am going to do now is compile this.

245
00:18:40,260 --> 00:18:52,230
So remember this command and this is just to kind of reiterate if you don't have a C++ compiler on your

246
00:18:52,230 --> 00:18:57,090
Windows machine yet, please go back and watch the C++ compiler.

247
00:18:57,090 --> 00:19:04,620
VIDEO For Windows, where I install many GW on windows, then come back to this point.

248
00:19:06,090 --> 00:19:09,540
So I use G Plus Plus Dash Dash version.

249
00:19:09,540 --> 00:19:17,250
This tells us that we for sure have the G Plus Plus package from GW so we can compile C++ code.

250
00:19:18,210 --> 00:19:25,490
All I have to do is G Plus Plus and then a space and then the name of our file, which is Hello World.

251
00:19:25,500 --> 00:19:33,120
So I start typing hello and then what I'm going to do is press tab again, just like we did before you

252
00:19:33,120 --> 00:19:35,550
notice that it nicely completes that for us.

253
00:19:35,560 --> 00:19:36,690
It doesn't autocomplete.

254
00:19:37,110 --> 00:19:42,330
And that is because we are inside the directory that has hello world and it recognized it and finished

255
00:19:42,330 --> 00:19:43,500
it for us when we press tab.

256
00:19:44,250 --> 00:19:54,090
Once I press enter, what will happen is that the C++ compiler will go through the code in here and

257
00:19:54,090 --> 00:19:59,460
it will turn it into something that the machine, which is our computer, can understand.

258
00:19:59,580 --> 00:20:00,870
That way, we can run it.

259
00:20:02,850 --> 00:20:03,690
I press enter.

260
00:20:05,070 --> 00:20:07,020
We don't see any output here.

261
00:20:07,110 --> 00:20:08,310
So that's a good thing.

262
00:20:08,700 --> 00:20:12,720
If you saw some stuff pop up, most likely you have errors.

263
00:20:12,930 --> 00:20:14,610
So don't worry, don't panic.

264
00:20:15,030 --> 00:20:21,060
Go back up to where you wrote the code and make sure that it matches exactly what I have here, and

265
00:20:21,060 --> 00:20:25,980
then try and run this same command again down here in the terminal.

266
00:20:27,180 --> 00:20:33,750
So let's see what happened to you that we're going to use another less because what should have happened

267
00:20:34,050 --> 00:20:43,170
is that the compiler should have generated an executable file which would have a dot e e extension instead

268
00:20:43,170 --> 00:20:44,550
of the Dot CPP.

269
00:20:44,940 --> 00:20:54,510
So if all was good, we should see both our Hello World Dot CPP code file, as well as the Dot XY executable

270
00:20:54,510 --> 00:20:59,370
file, which is the file that we will run to get our output.

271
00:20:59,790 --> 00:21:06,840
That is the C++ file that's been turned into something that can run on windows and is understood by

272
00:21:06,840 --> 00:21:07,530
the computer.

273
00:21:08,490 --> 00:21:10,770
So with that, I type else I press.

274
00:21:10,770 --> 00:21:11,250
Enter.

275
00:21:11,820 --> 00:21:12,510
Voila!

276
00:21:12,540 --> 00:21:13,410
Look at this.

277
00:21:13,590 --> 00:21:19,980
We have hello world dot CPP, but then we have a dot ICSI.

278
00:21:21,050 --> 00:21:25,400
OK, we might get why it says XY, but why that a.

279
00:21:25,910 --> 00:21:35,630
Well, the reason it says Ada XY is because we did not specify anything in here except to just compile.

280
00:21:36,960 --> 00:21:46,830
This program that we wrote the CP file, but we never told the compiler what we wanted the executable

281
00:21:46,830 --> 00:21:54,270
file to be named, and we can do that when you don't do that and you just do D Plus Plus and then a

282
00:21:54,270 --> 00:21:58,170
space and then the file name with the Dot CP extension.

283
00:21:58,410 --> 00:22:03,060
It just automatically defaults to calling the thing a dot XY.

284
00:22:03,060 --> 00:22:10,140
If you are on windows, or it might call it a dot out, depending on what other machine you are on or

285
00:22:10,140 --> 00:22:10,950
something else.

286
00:22:11,370 --> 00:22:15,360
But what we can actually do is instead.

287
00:22:17,110 --> 00:22:20,140
We can call it we can call it something else.

288
00:22:20,590 --> 00:22:24,760
So I have this a key, which is fine and it will run fine.

289
00:22:25,180 --> 00:22:27,760
But maybe I want to call it something else.

290
00:22:28,240 --> 00:22:33,730
I'm going to show you another command right now that you should be extremely careful with.

291
00:22:34,540 --> 00:22:43,270
Do not use this command on anything but something you are sure you do not want to ever see again.

292
00:22:44,140 --> 00:22:46,180
It is the remove command.

293
00:22:46,930 --> 00:22:56,170
And it is done with an R M. Sometimes the computer, the operating system will protect you from deleting

294
00:22:56,770 --> 00:23:01,960
things that you really shouldn't be messing around with, but not all the time.

295
00:23:02,680 --> 00:23:04,000
You don't really know.

296
00:23:04,120 --> 00:23:09,850
You might accidentally delete something that you really don't want to delete, so just be careful with

297
00:23:09,850 --> 00:23:10,240
this.

298
00:23:10,840 --> 00:23:15,550
But I am going to do rim in a and then a dot, and then I'm a press tab.

299
00:23:15,550 --> 00:23:21,820
And then we know that since it tab this out and completed it, that we are going to be deleting just

300
00:23:21,820 --> 00:23:25,870
the ADX e file I press enter.

301
00:23:26,950 --> 00:23:32,200
Now I'm going to take a look again to see what is in the directory, and we notice it is no longer there.

302
00:23:32,230 --> 00:23:33,220
There is no ETA.

303
00:23:35,630 --> 00:23:43,460
At this point, I'm going to do another G Plus Plus, but I'm going to do my hello world and then I'm

304
00:23:43,460 --> 00:23:44,450
going to do a dash.

305
00:23:44,620 --> 00:23:51,620
Oh, and that means that I want to specify I'm going to name the output file.

306
00:23:52,810 --> 00:23:54,880
And what do I want to call it?

307
00:23:55,840 --> 00:23:56,920
I think I want to call it.

308
00:23:57,580 --> 00:23:59,680
Hello, Dot VXI.

309
00:24:00,490 --> 00:24:05,050
So if I run this, it will compile.

310
00:24:05,350 --> 00:24:13,000
Then it says, Oh, you would like to name an output file because you put a hyphen o, which is also

311
00:24:13,000 --> 00:24:14,200
like a flag.

312
00:24:14,600 --> 00:24:17,470
You know, this is something you can refer to as a flag as well.

313
00:24:17,860 --> 00:24:26,830
And I'd put Hello XY afterwards because that tells the compiler what I want to name this output file,

314
00:24:26,860 --> 00:24:27,640
so I press enter.

315
00:24:30,680 --> 00:24:36,080
No problems there, so that's good, I type else again to see what happened, and here and there we

316
00:24:36,080 --> 00:24:39,500
go, we have a program called hello rather than a.

317
00:24:42,440 --> 00:24:52,670
Now what we can do is we can run this program by doing a dot and then a slash like this, and then I

318
00:24:52,670 --> 00:24:53,990
start typing Hello.

319
00:24:54,380 --> 00:24:56,990
And I press tab and we see hello.

320
00:24:58,430 --> 00:24:59,850
Now I press enter.

321
00:25:01,460 --> 00:25:09,440
And look what it does while it printed the words hello and a world to the console.

322
00:25:10,310 --> 00:25:17,450
So just to prove that it's actually doing the stuff that we wanted to do and it's printing whatever,

323
00:25:17,450 --> 00:25:21,050
it's not just some magical program that only does.

324
00:25:22,110 --> 00:25:24,780
Hello, world, no matter what you write in code here.

325
00:25:26,200 --> 00:25:28,040
Let's go ahead and change this.

326
00:25:28,060 --> 00:25:29,680
I'm going to change this to Dylan.

327
00:25:30,780 --> 00:25:34,900
And now I change this, it says to unsaved.

328
00:25:35,020 --> 00:25:36,410
So what am I going to do?

329
00:25:36,430 --> 00:25:45,620
I'm going to file save and now I am actually going to compile this again and I can.

330
00:25:45,640 --> 00:25:46,980
You notice that this is changing here.

331
00:25:46,990 --> 00:25:48,730
That's because I'm pressing up on the keyboard.

332
00:25:49,540 --> 00:25:53,680
So if I press up, it goes back to the previous command that I did.

333
00:25:53,680 --> 00:25:55,630
If I press up again, it goes before that.

334
00:25:55,780 --> 00:25:57,640
I press up again, it goes before that.

335
00:25:58,300 --> 00:26:02,980
And so that's a nice way to kind of backtrack in your history of what you've typed in the terminal,

336
00:26:02,980 --> 00:26:05,440
the commands you've ran actually in the terminal.

337
00:26:05,950 --> 00:26:07,140
And now I can just press enter.

338
00:26:07,150 --> 00:26:08,560
I don't have to retype this whole thing.

339
00:26:09,700 --> 00:26:12,610
I press enter and nothing happens, so we should be good to go.

340
00:26:12,970 --> 00:26:18,550
Now I'm going to press up again and up again, and you notice that it's the same command I used right

341
00:26:18,550 --> 00:26:19,750
here to run it.

342
00:26:20,680 --> 00:26:21,280
Hello.

343
00:26:21,770 --> 00:26:25,960
See, when I put the dot slash before it, and I'm going to press that, enter again.

344
00:26:27,280 --> 00:26:30,970
And while I look, it changed it to Hello Dylan, now.

345
00:26:31,240 --> 00:26:39,070
So that kind of shows you that whatever we put in between here is going to print out to the console.

346
00:26:40,180 --> 00:26:42,760
Something else that I did not really mention.

347
00:26:43,210 --> 00:26:47,320
I just kind of typed it where these quotations here.

348
00:26:48,350 --> 00:26:54,440
You must use these quotations for right now if you just want to make some more programs that print out

349
00:26:54,440 --> 00:26:55,220
different stuff.

350
00:26:56,290 --> 00:26:59,380
Make sure to use the quote, the double quotes right now.

351
00:27:00,430 --> 00:27:07,450
This is something called a string right here, and we're going to be getting into that in the near future.

352
00:27:08,230 --> 00:27:16,660
Like I said, this is the first video we're going to take like a huge step backwards and start talking

353
00:27:16,660 --> 00:27:19,630
about all these little pieces of C++.

354
00:27:19,660 --> 00:27:23,500
This is a lot and we're not going to be like necessarily.

355
00:27:24,600 --> 00:27:30,090
Using this type of program over and over and just explaining what we're going to do is take a big step

356
00:27:30,090 --> 00:27:33,720
back and learn about data types and all kinds of stuff.

357
00:27:33,750 --> 00:27:41,310
This was just to like, say, Hey, you can read program in C++ that print something out just so it

358
00:27:41,310 --> 00:27:45,990
felt like you actually knew how to write a program instead of just going over a ton of theory right

359
00:27:45,990 --> 00:27:50,550
away, which will take a huge step back and we'll go over the theory before the next program, we write.

360
00:27:52,460 --> 00:28:00,440
OK, so hopefully this was a fun lecture for you and that you feel pretty cool if this is the first

361
00:28:00,440 --> 00:28:01,280
program you wrote.

362
00:28:01,310 --> 00:28:04,370
You wrote some code, you know how to write a program now.

363
00:28:05,300 --> 00:28:12,890
You technically can write a program that prints any text to the council now because you could put anything

364
00:28:12,890 --> 00:28:16,100
in here between these double quotes.

365
00:28:16,610 --> 00:28:18,980
And it is going to print it to the council.

366
00:28:19,220 --> 00:28:22,040
I can just smash the keyboard and put a ton of stuff here.

367
00:28:22,130 --> 00:28:22,730
Like this?

368
00:28:23,180 --> 00:28:23,900
Go here.

369
00:28:24,560 --> 00:28:25,610
I can save it.

370
00:28:25,940 --> 00:28:29,150
I can go here and press the up to compile it again.

371
00:28:29,750 --> 00:28:35,930
I can go up here to run it, run it again and look, it just prints all of that stuff that I typed here.

372
00:28:35,930 --> 00:28:43,520
So maybe not the most amazing program of all time, but still pretty cool, right?

373
00:28:43,520 --> 00:28:44,600
If it's your first program.

374
00:28:45,880 --> 00:28:54,370
So congratulations on getting just this far, even you have learned how to write a program in C++ in

375
00:28:54,370 --> 00:28:58,580
the next lectures, we are going to be going over some other editors.

376
00:28:58,600 --> 00:29:08,410
We're going to take a huge step back and we are going to go over some data types and stuff like that.

377
00:29:09,310 --> 00:29:09,790
But.

378
00:29:10,750 --> 00:29:18,490
Till then, go ahead and practice just typing some things in here, if you repeat this code, just you

379
00:29:18,490 --> 00:29:25,210
clicking the keys and doing it, even though you're not so sure what all of this really means, it will

380
00:29:25,300 --> 00:29:27,550
still help you, but we are going to go.

381
00:29:28,610 --> 00:29:36,810
Way back and start at the very basics now and explain all the really fundamental concepts, OK?

382
00:29:36,850 --> 00:29:40,250
With that, I will see you in the next lecture.
