Skip to player
Skip to main content
Skip to footer
Search
Connect
Watch fullscreen
Like
Comments
Bookmark
Share
Add to Playlist
Report
3. Demo - First Program
Technical Education
Follow
7/22/2024
3. Demo - First Program
Category
ЁЯУЪ
Learning
Transcript
Display full video transcript
00:00
let us write our first program in C++ here I start Xcode create a new
00:06
project in Xcode and select this option that is command line tool then you
00:14
have to mention some project name that is first is the project name and the
00:18
language selected is C++ there are other options also available select C++
00:24
then next so where is supposed to create it so you can set the path here
00:30
wherever you want to create your project say create here are the project files so
00:38
click on main.cpp you can see that a ready-made code is given so it has
00:43
already generated a piece of code that is executable code here are a few
00:48
comments I'll remove them I'll remove these panels yeah see this command line
00:58
arguments these are optional in C++ I'll just remove these command line
01:03
arguments will study about these after some time so here is a readily available
01:09
hello world program I'll run this let us see what I'll get here is an output
01:16
window yeah hello world the output is given here here std scope resolution is
01:27
used for accessing cout so instead of this we can also mention using namespace
01:36
using namespace std now I don't have to use std for using cout object let us
01:45
run this and check once again that's it so this is working the same program I'll
01:56
just modify it for adding two numbers I'll remove these lines and I will write
02:01
on the code here for adding two numbers I'll declare few variables integer a b
02:07
and c see you can see that's a prompting here if there is any error in the
02:13
statements see out enter two numbers then seen a and b then see a sign a plus
02:32
B see out sum is then give a space and see so this is a program for taking two
02:46
numbers from keyboard and adding them and displaying the result so these two
02:51
lines are for taking input from the user these two lines are interactive as it is
02:55
giving a message to the user informing him to enter two numbers then adding two
03:00
numbers and finding sum and displaying sum here let us run this now here is a
03:08
message enter two numbers I'll enter two numbers 10 and 30 now here the sum is 40
03:15
I should get nl here so that the last message should come in next line nl
03:23
let me run
03:29
enter two numbers 10 and 30 so now this program ended with exit code 0 that is
03:36
coming in the next line so sum is 40 that's it so let me modify the same
03:42
program and make it as a program for taking the user name and displaying a
03:47
welcome message so string is a built-in class available in C++ library that is
03:54
stdio stream and we can access in the namespace std here I'll give a message
04:00
see out may I know your name then seen name so str is a variable name then see
04:14
out hello a space here so that space is there in between hello and name of a
04:26
user I'll run the program may I know your name let us say name is John so
04:37
hello John it's working I'll run it once more I'll give the name Sai Kumar
04:46
let us see what happens it's giving just Sai here it's not giving the other name
04:54
because the name is having two words here it's reading only one word if I
04:59
want to read all the words entered in a string then the right method is there's
05:07
a function available called get line get line takes input stream that is seen
05:13
and next is string variable string object now let us read it using get line
05:21
this is the method for reading an entire line from the keyboard may I know your
05:30
name so Sai Kumar now I got a full name Sai Kumar that's it so this is a way you
05:40
can access the strings whenever you require there's a built-in object
05:43
available in C++ and it's a very useful object
Recommended
8:12
|
Up next
рдЙрд░рдг рдкреНрд░рдХрд░рдгрд╛рдд рд▓рд╡ рдЬрд┐рд╣рд╛рджрдЪрд╛ рдЖрд░реЛрдк рдХрд░рдгрд╛рд░рд╝реНрдпрд╛ рдиреЗрддреНрдпрд╛рдВрдирд╛ рд╢рд░реНрдорд┐рд▓рд╛ рд░рд╛рдЬ рдард╛рдХрд░реЗрдВрдиреА рд╕реБрдирд╛рд╡рд▓рдВ...
Technical Education
7/30/2024
4:01
CM Yogi on Love Jihad: рд▓рд╡ рдЬрд┐рд╣рд╛рдж рдкрд░ рдЙрдореНрд░рдХреИрдж | CM Yogi Big Decision | Religion change | рд╡рдирдЗрдВрдбрд┐рдпрд╛ рд╣рд┐рдВрджреА
Technical Education
7/30/2024
3:15
Bhopal News: рднреЛрдкрд╛рд▓ рдХреЗ рд▓рд┐рдП рдкрд╣рд▓реА рдЦреБрд╢рдЦрдмрд░реА, рдХреЛрд▓рд╛рд░ рдбреИрдо рдХреЗ рджреЛ рдЧреЗрдЯ рдЦреБрд▓реЗ, рд▓рдЧрд╛рддрд╛рд░ рдЬрд╛рд░реА рд╣реИ рдЭрдорд╛рдЭрдо рдмрд╛рд░рд┐рд╢
Technical Education
7/30/2024
4:18
#usa #america #canada #uk #love #newyork #instagram #california #travel #instagood #fashion #photography #australia #india #germany #trump #london #follow #dubai #france #europe #like #art #miami #florida #a #italy #unitedstates #nyc #music
Technical Education
7/30/2024
1:48
1. Install Compiler
Technical Education
7/22/2024
16:34
2. How Computers Works
Technical Education
7/22/2024
1:08
1. Fundamentals
Technical Education
7/22/2024
3:03
1. Instructors Note
Technical Education
7/22/2024
5:22
3. Setup Dev-C++ and Settings
Technical Education
7/22/2024
6:42
3. Introduction to Number Systems
Technical Education
7/22/2024
6:10
4. Setup Visual Studio
Technical Education
7/22/2024
6:16
2. Setup CodeBlocks and Settings
Technical Education
7/22/2024
8:34
1. Skeleton of C++ Program
Technical Education
7/22/2024
5:00
How_Can_ISO9001_Help_Your_Business_Succeed
Technical Education
7/18/2024
1:00
Section_4_Introduction
Technical Education
7/18/2024
3:30
What_Is_A_QMS
Technical Education
7/18/2024
5:40
Clause_4
Technical Education
7/18/2024
5:12
Management_Responsibility
Technical Education
7/18/2024
8:55
Continual_Improvement
Technical Education
7/18/2024
7:10
The_PDCA_Cycle
Technical Education
7/18/2024
2:45
Quality_Manuel_Template
Technical Education
7/18/2024
9:29
Tips_and_Tricks
Technical Education
7/18/2024
2:37
Roll_Out
Technical Education
7/18/2024
5:45
Kaizen
Technical Education
7/18/2024
3:06
Learning_Outcomes
Technical Education
7/18/2024