Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
16 views
Input Output
Uploaded by
Rahul 4sure
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Input Output For Later
Download
Save
Save Input Output For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
16 views
Input Output
Uploaded by
Rahul 4sure
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Input Output For Later
Carousel Previous
Carousel Next
Save
Save Input Output For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 7
Search
Fullscreen
4.1 C++STREAMS C++ provides a new technique for handling I/O operations through a mechanism known as_streams, ‘ream is an_abstraction that refers to the flow of data. The flow of data may be from an input device (keyboard, dis ile etc.) to.a program in main. memory of-from a progras to any-output device (monitor, printer etc.) —.. a 4 Stréamis can be classified into two categories : gOutput Stream : eTnput Si vutput stream, the flow of data (bytes) is from the program to the output device. Output operations are carried out_using output sweat CFF. Inaput stream, the flow of data is from the input device to the program in main memory. In C+, input operations are carried out using input stream: *43 INPUTUSING cin ‘The cin is used to input a number, a character or a string of characters from a standaj input device i.e. keyboard. ——— The standard input stream in C++ is represented using pre-defined object ‘cin ( pronounced as see-in) so as to perform standard input operations. The cin stream is used in conjunction_with bitwise right shif shift ft operator >) for performing standard input operations. The syntax for the standard input stream opera ii Predefined object Extrac ‘or get from operator IC L. cin ‘>> var: le ; e ; //Data flow in the direction of arrow Omere variable cant be of any basic or user defined data type. In the cin statement, cin is wi rowed by the extraction or get from operator (>>) and then followed with variable into which jnput data is to be stored. The operator (>>) is called extraction or get from operator as it we Tas the data from standard input stream ein connected to standard input device (keyboard) et eends the data into the variable that follows it. ‘te whole process of inputting using cin is shown below : T Variable , HE-©) Keyboard (___ Cc Fig. 4.3 - Input using cin Now, consider the following statements, \se ‘oO et int x; . cin>>x; ‘This input statement accepts an integer value from keyboard and stores in the variable x4.2 OUTPUT USING cout The-cout is used to display a variable, constant or expression onto the standard outpt device ie. monitor. —— oe In C++, the standard output stream is represented _using pre-defined object cout (Pronounced as see-out), so as to perform standard output operation. The cout stream is used in’| Conjunction with bitwise left shift operator (<<) for performing standard output operations. The syntax for the standard output stream operation ispredefined object "Insertion or Put to operator esd | Date fl Ga ens ce ore where data can be a variable, expression, user-defined datatypes or a constant. In th cout statement, oUt is ‘followed by the-insertion or put t operator (<<) and then fi ith data items which are to be displayed. he operator (<<) is called the insertion or put to operator as it inserts the data that follows it into the cout stream whicl further directs the contents to the ese Ne ead te display_screen- The whole process of outputing using cout corresponding to statement cout<<"KING” ; js shown below data Now, consider the following statement, cout<<"Hello Everybody”; Monitor Fig 4.2 - Output using coutThe insertion operator (<<) can be used more then once in a same cout statement. Such output operations are called chaining or cascaded output operations. The main advantage of repeating the insertion operator is to display a combination of variables, constants and expressions in the same statement. Consider the example, (avads4 ’ “= “<
: Fru quam to eobeul #include
Nos: int a,b,c,sum; : ‘ cout<<"Enter three numbers = cin>>a>>b>>c; “sum=atbtc; z cout<<"Sum = "<
You might also like
Chapter 9 Input Output Operators
PDF
No ratings yet
Chapter 9 Input Output Operators
12 pages
9 Input and Output Operators-1 (2)
PDF
No ratings yet
9 Input and Output Operators-1 (2)
2 pages
ch9
PDF
No ratings yet
ch9
5 pages
Plugin-00 - C++ IO Background
PDF
No ratings yet
Plugin-00 - C++ IO Background
5 pages
Chapter 4 C++ Expression, Statements, Standard
PDF
No ratings yet
Chapter 4 C++ Expression, Statements, Standard
4 pages
M4 Guide
PDF
No ratings yet
M4 Guide
7 pages
For: COP 3330. Object Oriented Programming (Using C++)
PDF
No ratings yet
For: COP 3330. Object Oriented Programming (Using C++)
11 pages
Basic Input Output - C++ Documentation
PDF
No ratings yet
Basic Input Output - C++ Documentation
4 pages
Chapter 9 - Input and Output Operators
PDF
100% (1)
Chapter 9 - Input and Output Operators
5 pages
PF Lecture (Theory) 02-Variables
PDF
No ratings yet
PF Lecture (Theory) 02-Variables
55 pages
LESSON 5 InputOutput
PDF
No ratings yet
LESSON 5 InputOutput
14 pages
CPP Tuts 1
PDF
No ratings yet
CPP Tuts 1
3 pages
Chapter-10 - OOPC IO Operation
PDF
No ratings yet
Chapter-10 - OOPC IO Operation
28 pages
Lecture 2 - Basic Input and Output
PDF
No ratings yet
Lecture 2 - Basic Input and Output
28 pages
Simple Programs in C++: Objective
PDF
No ratings yet
Simple Programs in C++: Objective
3 pages
OOP Unit 4 Notes
PDF
No ratings yet
OOP Unit 4 Notes
38 pages
5 - Input-Output Streams as an Introduction
PDF
No ratings yet
5 - Input-Output Streams as an Introduction
26 pages
C++ Programming: From Problem Analysis To Program Design, Fourth Edition (Chapter 3: Input/Output)
PDF
No ratings yet
C++ Programming: From Problem Analysis To Program Design, Fourth Edition (Chapter 3: Input/Output)
26 pages
C++ Basic Input_Output - Tutorialspoint
PDF
No ratings yet
C++ Basic Input_Output - Tutorialspoint
4 pages
Lesson2 Basic Input Output in C
PDF
No ratings yet
Lesson2 Basic Input Output in C
4 pages
output Operator
PDF
No ratings yet
output Operator
2 pages
Inputandoutput
PDF
No ratings yet
Inputandoutput
5 pages
EEB 334 - Chapter 6
PDF
No ratings yet
EEB 334 - Chapter 6
29 pages
Output Operator
PDF
No ratings yet
Output Operator
1 page
bplck-205d-module-4
PDF
No ratings yet
bplck-205d-module-4
23 pages
Topic: Concept of Stream: Course Name
PDF
No ratings yet
Topic: Concept of Stream: Course Name
17 pages
File: Main - CPP Author: A K Created On April 28, 2018 / #Include
PDF
No ratings yet
File: Main - CPP Author: A K Created On April 28, 2018 / #Include
4 pages
CPP Lecture 04
PDF
No ratings yet
CPP Lecture 04
12 pages
Lect - 4 - Introduction To Programming2
PDF
No ratings yet
Lect - 4 - Introduction To Programming2
32 pages
C++- Week5
PDF
No ratings yet
C++- Week5
41 pages
Introduction To Programming
PDF
No ratings yet
Introduction To Programming
40 pages
Chapter 2&3. C++ Basics
PDF
No ratings yet
Chapter 2&3. C++ Basics
93 pages
Computer Programming (M4-Main) PDF
PDF
No ratings yet
Computer Programming (M4-Main) PDF
44 pages
Moving From C To C++
PDF
No ratings yet
Moving From C To C++
29 pages
Formatted Input / Output
PDF
No ratings yet
Formatted Input / Output
13 pages
Basic Input & Output
PDF
No ratings yet
Basic Input & Output
19 pages
13.1 - Input and Output (I/O) Streams: by A Lex, On Februa Ry 28Th, 2008
PDF
No ratings yet
13.1 - Input and Output (I/O) Streams: by A Lex, On Februa Ry 28Th, 2008
8 pages
Week 3
PDF
No ratings yet
Week 3
4 pages
Lecture 2-3: C++ Basic Constructs
PDF
No ratings yet
Lecture 2-3: C++ Basic Constructs
61 pages
III Input output
PDF
No ratings yet
III Input output
48 pages
Chapter 3 Expressions and Interactivity
PDF
No ratings yet
Chapter 3 Expressions and Interactivity
54 pages
Introduction To C++
PDF
No ratings yet
Introduction To C++
79 pages
Chap3 CompletingTheBasic
PDF
No ratings yet
Chap3 CompletingTheBasic
30 pages
Basic Inputoutput
PDF
No ratings yet
Basic Inputoutput
5 pages
Chapter One: Basics of C++: Structure of A Program #Include
PDF
No ratings yet
Chapter One: Basics of C++: Structure of A Program #Include
34 pages
Basic Input Output
PDF
No ratings yet
Basic Input Output
4 pages
Basic Input/Output
PDF
No ratings yet
Basic Input/Output
7 pages
Master C++ 8
PDF
No ratings yet
Master C++ 8
16 pages
Chapter2introtoc 2B 2bpart2
PDF
No ratings yet
Chapter2introtoc 2B 2bpart2
48 pages
C++ ClassI
PDF
No ratings yet
C++ ClassI
48 pages
Managing Console IO Operations
PDF
No ratings yet
Managing Console IO Operations
36 pages
Chapter 2 Basic Program Elements Part 2
PDF
No ratings yet
Chapter 2 Basic Program Elements Part 2
54 pages
C++ Prog and Appl
PDF
No ratings yet
C++ Prog and Appl
5 pages
Completing The Basics: Introduction To Computer Science
PDF
No ratings yet
Completing The Basics: Introduction To Computer Science
25 pages
BMS 201 C++ Programming Language
PDF
No ratings yet
BMS 201 C++ Programming Language
41 pages
Basic Input
PDF
No ratings yet
Basic Input
2 pages
Programming Fundamental 5 Lec
PDF
No ratings yet
Programming Fundamental 5 Lec
47 pages
Programming in C++ (Week 1)
PDF
No ratings yet
Programming in C++ (Week 1)
44 pages
Computer Programming: Content
PDF
No ratings yet
Computer Programming: Content
12 pages