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)
22 views
7 pages
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
Save
Save Input Output For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
22 views
7 pages
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
Carousel Previous
Carousel Next
Download
Save
Save Input Output For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save Input Output For Later
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
PF Lecture (Theory) 02-Variables
PDF
No ratings yet
PF Lecture (Theory) 02-Variables
55 pages
Chapter One: Basics of C++: Structure of A Program #Include
PDF
100% (1)
Chapter One: Basics of C++: Structure of A Program #Include
34 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
C++ - Week5
PDF
No ratings yet
C++ - Week5
41 pages
Lecture 2-3-1
PDF
No ratings yet
Lecture 2-3-1
68 pages
Lecture 4
PDF
No ratings yet
Lecture 4
31 pages
Lecture 2 - Basic Input and Output
PDF
No ratings yet
Lecture 2 - Basic Input and Output
28 pages
Chapter-10 - OOPC IO Operation
PDF
No ratings yet
Chapter-10 - OOPC IO Operation
28 pages
Chapter 2 Basic Program Elements Part 2
PDF
No ratings yet
Chapter 2 Basic Program Elements Part 2
54 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
Introduction To C++
PDF
No ratings yet
Introduction To C++
79 pages
Computer Programming (M4-Main) PDF
PDF
No ratings yet
Computer Programming (M4-Main) PDF
44 pages
LESSON 5 InputOutput
PDF
No ratings yet
LESSON 5 InputOutput
14 pages
Chapter 2&3. C++ Basics
PDF
No ratings yet
Chapter 2&3. C++ Basics
93 pages
Chapter 9 Input Output Operators
PDF
No ratings yet
Chapter 9 Input Output Operators
12 pages
Chapter2introtoc 2B 2bpart2
PDF
No ratings yet
Chapter2introtoc 2B 2bpart2
48 pages
Sem3 (OOP) UNIT - 1
PDF
No ratings yet
Sem3 (OOP) UNIT - 1
12 pages
Lesson2 Basic Input Output in C
PDF
No ratings yet
Lesson2 Basic Input Output in C
4 pages
Introduction To Programming
PDF
No ratings yet
Introduction To Programming
40 pages
Master C++ 8
PDF
No ratings yet
Master C++ 8
16 pages
Lecture 2-3: C++ Basic Constructs
PDF
No ratings yet
Lecture 2-3: C++ Basic Constructs
61 pages
CPP Lecture 04
PDF
No ratings yet
CPP Lecture 04
12 pages
Output Operator
PDF
No ratings yet
Output Operator
2 pages
OOP Unit 4 Notes
PDF
No ratings yet
OOP Unit 4 Notes
38 pages
Output Operator
PDF
No ratings yet
Output Operator
1 page
Managing Console IO Operations
PDF
No ratings yet
Managing Console IO Operations
36 pages
Moving From C To C++
PDF
No ratings yet
Moving From C To C++
29 pages
M4 Guide
PDF
No ratings yet
M4 Guide
7 pages
BPLCK 205d Module 4
PDF
No ratings yet
BPLCK 205d Module 4
23 pages
5 - Input-Output Streams As An Introduction
PDF
No ratings yet
5 - Input-Output Streams As An Introduction
26 pages
Input and Output Operations
PDF
No ratings yet
Input and Output Operations
3 pages
Chap3 CompletingTheBasic
PDF
No ratings yet
Chap3 CompletingTheBasic
30 pages
Completing The Basics: Introduction To Computer Science
PDF
No ratings yet
Completing The Basics: Introduction To Computer Science
25 pages
C++ Basic Input - Output - Tutorialspoint
PDF
No ratings yet
C++ Basic Input - Output - Tutorialspoint
4 pages
EEB 334 - Chapter 6
PDF
No ratings yet
EEB 334 - Chapter 6
29 pages
Basic Input & Output
PDF
No ratings yet
Basic Input & Output
19 pages
Week 3
PDF
No ratings yet
Week 3
4 pages
Chapter 4 C++ Expression, Statements, Standard
PDF
No ratings yet
Chapter 4 C++ Expression, Statements, Standard
4 pages
CH 9
PDF
No ratings yet
CH 9
5 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
PDF
No ratings yet
Basic Input Output
4 pages
Module4 Notes
PDF
No ratings yet
Module4 Notes
19 pages
BMS 201 C++ Programming Language
PDF
No ratings yet
BMS 201 C++ Programming Language
41 pages
Plugin-00 - C++ IO Background
PDF
No ratings yet
Plugin-00 - C++ IO Background
5 pages
Basic Input/Output
PDF
No ratings yet
Basic Input/Output
7 pages
Basic Inputoutput
PDF
No ratings yet
Basic Inputoutput
5 pages
9 Input and Output Operators-1
PDF
No ratings yet
9 Input and Output Operators-1
2 pages
Topic: Concept of Stream: Course Name
PDF
No ratings yet
Topic: Concept of Stream: Course Name
17 pages
Inputandoutput
PDF
No ratings yet
Inputandoutput
5 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
Basic Input Output - C++ Documentation
PDF
No ratings yet
Basic Input Output - C++ Documentation
4 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
Simple Programs in C++: Objective
PDF
100% (1)
Simple Programs in C++: Objective
3 pages
CPP Tuts 1
PDF
No ratings yet
CPP Tuts 1
3 pages
Chapter 9 - Input and Output Operators
PDF
100% (1)
Chapter 9 - Input and Output Operators
5 pages
C++ ClassI
PDF
No ratings yet
C++ ClassI
48 pages
Formatted Input / Output
PDF
No ratings yet
Formatted Input / Output
13 pages