SlideShare a Scribd company logo
Output in c++
Output is the things that appears on the console
screen
What do you think we do in order to print
something on the screen?
cout << ;
A key word that hast
to be used in
stuff on the screen
This is called a semicolon
and is used to indicate the
end of the statement
In this space between (cout) and (;) we write
the thing that we want to print
Let’s try these codes:
cout << 3 ;
cout << 3+4;
cout << 3*4;
cout << 4/2;
cout << 4-3;
Note: I can print more than one thing with 1 cout
cout << 3 << 6 << 2; Result : 362
If we want to print a word or a sentence we have
to put it inside “ “ (double quotes).
cout << “Ghada”;
cout << “Hello World!”;
If I want to print a single character we have
to put it inside ’ ‘ (single quotes).
cout << ‘a’ ; cout << ‘A’;
We know that if I said : cout << “Hello” <<“world” ;
The result printed on screen will be :Helloworld;
What if I want to make it (Hello world)
with a space between the 2 words??
Answer:
cout << “Hello” << “ “ << “world” ;
Anything in a “” will be printed as it is, so when I put
a space between “” it will be printed as a single space
between the 2 words
cout << “Hello” << “_” << “world ”;
Result : Hello_world
cout << “….” << “Hello” << “….” << “world ” << “….”;
Result : …Hello…world…
cout << 3 + 4; cout << “3 + 4”;
Result: Result:7 3 + 4
The operation is put inside “”
so it is not treated as an
operation,
it is treated as a sentence which
needs to be printed as it is.
A normal operation.
So the value is calculated
and printed on the screen.
cout << “This is the first line”;
cout << “This is the second line”;
Try these 2 lines of code and see what the output will look like.
Result: This is the first lineThis is the second line
What if we want to print each statement in a separate line??
cout << “This is the first line” << endl;
cout << “This is the second line”;
Result: This is the first line
This is the second line
Prints a new line
after printing
the first statement

More Related Content

Viewers also liked (12)

PPTX
Constant, variables, data types
Pratik Devmurari
 
PPT
Data types and Operators
raksharao
 
PPTX
04 data types & variables
dhrubo kayal
 
PPS
Data types ,variables,array
Gujarat Technological University
 
PPTX
Data types and variables
Ghada Shebl
 
PDF
Sdd HSC Summary
mary_ramsay
 
PPTX
Software Design and Development
fairvalehigh
 
PDF
IPT HSC Summary
mary_ramsay
 
PPTX
Variables, Data Types, Operator & Expression in c in detail
gourav kottawar
 
PPTX
R Programming: Variables & Data Types
Rsquared Academy
 
PPT
02. Data Type and Variables
Tommy Vercety
 
PPT
Variables and Tables
PeteHosky
 
Constant, variables, data types
Pratik Devmurari
 
Data types and Operators
raksharao
 
04 data types & variables
dhrubo kayal
 
Data types ,variables,array
Gujarat Technological University
 
Data types and variables
Ghada Shebl
 
Sdd HSC Summary
mary_ramsay
 
Software Design and Development
fairvalehigh
 
IPT HSC Summary
mary_ramsay
 
Variables, Data Types, Operator & Expression in c in detail
gourav kottawar
 
R Programming: Variables & Data Types
Rsquared Academy
 
02. Data Type and Variables
Tommy Vercety
 
Variables and Tables
PeteHosky
 

Similar to Output in c++ (cout) (20)

PPTX
Intro To C++ - Class 03 - An Introduction To C++ Programming, Part II
Blue Elephant Consulting
 
PPTX
Intro To C++ - Class 3 - Sample Program
Blue Elephant Consulting
 
PPTX
Lesson 2 starting output
WayneJones104
 
PPT
Chapter2
Anees999
 
PPTX
Getting started in c++
Neeru Mittal
 
PPTX
clc02_cpp_presentation_edit3 (1) 1.pptx
jminrin0212
 
PDF
PROGRAMMING FUNDAMENTALS BASICS LECTURE 2
AmmarAhmad42878
 
DOCX
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
jaggernaoma
 
PDF
fundamental of c++ for students of b.tech iii rd year student
Somesh Kumar
 
PPTX
Basics Of C++.pptx
DineshDhuri4
 
DOCX
C++ Tutorial.docx
PinkiVats1
 
PPT
C++ basic.ppt
SityogInstituteOfTec1
 
PDF
C++ and OOPS Crash Course by ACM DBIT | Grejo Joby
GrejoJoby1
 
PPTX
C++ lecture 01
HNDE Labuduwa Galle
 
PDF
Chap 3 c++
Widad Jamaluddin
 
PPT
02a fundamental c++ types, arithmetic
Manzoor ALam
 
PPT
pengenalan mengenai computer dan programming
aqilahkhairuddin389
 
PPTX
Structure of a C++ Program in computer programming .pptx
bereketalemayehu34
 
PDF
Lecture1
Amisha Dalal
 
Intro To C++ - Class 03 - An Introduction To C++ Programming, Part II
Blue Elephant Consulting
 
Intro To C++ - Class 3 - Sample Program
Blue Elephant Consulting
 
Lesson 2 starting output
WayneJones104
 
Chapter2
Anees999
 
Getting started in c++
Neeru Mittal
 
clc02_cpp_presentation_edit3 (1) 1.pptx
jminrin0212
 
PROGRAMMING FUNDAMENTALS BASICS LECTURE 2
AmmarAhmad42878
 
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
jaggernaoma
 
fundamental of c++ for students of b.tech iii rd year student
Somesh Kumar
 
Basics Of C++.pptx
DineshDhuri4
 
C++ Tutorial.docx
PinkiVats1
 
C++ basic.ppt
SityogInstituteOfTec1
 
C++ and OOPS Crash Course by ACM DBIT | Grejo Joby
GrejoJoby1
 
C++ lecture 01
HNDE Labuduwa Galle
 
Chap 3 c++
Widad Jamaluddin
 
02a fundamental c++ types, arithmetic
Manzoor ALam
 
pengenalan mengenai computer dan programming
aqilahkhairuddin389
 
Structure of a C++ Program in computer programming .pptx
bereketalemayehu34
 
Lecture1
Amisha Dalal
 
Ad

Recently uploaded (20)

PPTX
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
PDF
SG1-ALM-MS-EL-30-0008 (00) MS - Isolators and disconnecting switches.pdf
djiceramil
 
PPTX
Introduction to Fluid and Thermal Engineering
Avesahemad Husainy
 
PPTX
Online Cab Booking and Management System.pptx
diptipaneri80
 
PPTX
Precedence and Associativity in C prog. language
Mahendra Dheer
 
PDF
Air -Powered Car PPT by ER. SHRESTH SUDHIR KOKNE.pdf
SHRESTHKOKNE
 
PDF
Jual GPS Geodetik CHCNAV i93 IMU-RTK Lanjutan dengan Survei Visual
Budi Minds
 
PPTX
Chapter_Seven_Construction_Reliability_Elective_III_Msc CM
SubashKumarBhattarai
 
PPTX
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
PDF
20ME702-Mechatronics-UNIT-1,UNIT-2,UNIT-3,UNIT-4,UNIT-5, 2025-2026
Mohanumar S
 
PDF
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
PPTX
Water resources Engineering GIS KRT.pptx
Krunal Thanki
 
PDF
Machine Learning All topics Covers In This Single Slides
AmritTiwari19
 
PPTX
sunil mishra pptmmmmmmmmmmmmmmmmmmmmmmmmm
singhamit111
 
PDF
Zero Carbon Building Performance standard
BassemOsman1
 
PPTX
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
PPTX
quantum computing transition from classical mechanics.pptx
gvlbcy
 
PDF
4 Tier Teamcenter Installation part1.pdf
VnyKumar1
 
PDF
Advanced LangChain & RAG: Building a Financial AI Assistant with Real-Time Data
Soufiane Sejjari
 
PPTX
Ground improvement techniques-DEWATERING
DivakarSai4
 
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
SG1-ALM-MS-EL-30-0008 (00) MS - Isolators and disconnecting switches.pdf
djiceramil
 
Introduction to Fluid and Thermal Engineering
Avesahemad Husainy
 
Online Cab Booking and Management System.pptx
diptipaneri80
 
Precedence and Associativity in C prog. language
Mahendra Dheer
 
Air -Powered Car PPT by ER. SHRESTH SUDHIR KOKNE.pdf
SHRESTHKOKNE
 
Jual GPS Geodetik CHCNAV i93 IMU-RTK Lanjutan dengan Survei Visual
Budi Minds
 
Chapter_Seven_Construction_Reliability_Elective_III_Msc CM
SubashKumarBhattarai
 
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
20ME702-Mechatronics-UNIT-1,UNIT-2,UNIT-3,UNIT-4,UNIT-5, 2025-2026
Mohanumar S
 
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
Water resources Engineering GIS KRT.pptx
Krunal Thanki
 
Machine Learning All topics Covers In This Single Slides
AmritTiwari19
 
sunil mishra pptmmmmmmmmmmmmmmmmmmmmmmmmm
singhamit111
 
Zero Carbon Building Performance standard
BassemOsman1
 
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
quantum computing transition from classical mechanics.pptx
gvlbcy
 
4 Tier Teamcenter Installation part1.pdf
VnyKumar1
 
Advanced LangChain & RAG: Building a Financial AI Assistant with Real-Time Data
Soufiane Sejjari
 
Ground improvement techniques-DEWATERING
DivakarSai4
 
Ad

Output in c++ (cout)

  • 2. Output is the things that appears on the console screen What do you think we do in order to print something on the screen?
  • 3. cout << ; A key word that hast to be used in stuff on the screen This is called a semicolon and is used to indicate the end of the statement In this space between (cout) and (;) we write the thing that we want to print
  • 4. Let’s try these codes: cout << 3 ; cout << 3+4; cout << 3*4; cout << 4/2; cout << 4-3; Note: I can print more than one thing with 1 cout cout << 3 << 6 << 2; Result : 362
  • 5. If we want to print a word or a sentence we have to put it inside “ “ (double quotes). cout << “Ghada”; cout << “Hello World!”; If I want to print a single character we have to put it inside ’ ‘ (single quotes). cout << ‘a’ ; cout << ‘A’;
  • 6. We know that if I said : cout << “Hello” <<“world” ; The result printed on screen will be :Helloworld; What if I want to make it (Hello world) with a space between the 2 words?? Answer: cout << “Hello” << “ “ << “world” ;
  • 7. Anything in a “” will be printed as it is, so when I put a space between “” it will be printed as a single space between the 2 words cout << “Hello” << “_” << “world ”; Result : Hello_world cout << “….” << “Hello” << “….” << “world ” << “….”; Result : …Hello…world…
  • 8. cout << 3 + 4; cout << “3 + 4”; Result: Result:7 3 + 4 The operation is put inside “” so it is not treated as an operation, it is treated as a sentence which needs to be printed as it is. A normal operation. So the value is calculated and printed on the screen.
  • 9. cout << “This is the first line”; cout << “This is the second line”; Try these 2 lines of code and see what the output will look like. Result: This is the first lineThis is the second line What if we want to print each statement in a separate line?? cout << “This is the first line” << endl; cout << “This is the second line”; Result: This is the first line This is the second line Prints a new line after printing the first statement