












































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of various methods for inputting and outputting data in c++ using streams, including input statements, prompting for interactive input/output, using data files, object-oriented design principles, and functional decomposition methodology. It covers the use of istream and ostream libraries, reading and skipping characters, and string input using both >> and getline() functions.
Typology: Slides
1 / 52
This page cannot be seen from the preview
Don't miss anything!













































4
5
In your program you can assign(give) a value to the variable by using the assignment operator =
ageOfDog = 12;
or by another method, such as
cout << “How old is your dog?”; cin >> ageOfDog;
7
cin >> length; cin >> width;
cin >> length >> width;
cin >> Variable >> Variable.. .;
8
10
NOTE: A file reading marker is left pointing to the newline character after the „C‟ in the input stream
first middle last
first middle last
11
cin
(of type istream)
cout
(of type ostream)
Keyboard Screen
executing program
input data output data
13
int i; 25 A\n char ch; 16.9\n float x; cin >> i; 25 A\n 16.9\n
cin >> ch; 25 A\n 16.9\n
cin >> x; 25 A\n
16.9\n
i ch x
i ch x
i ch x
i ch x
NOTE: shows the location of the file reading marker
14
NOTE: The file reading marker is left pointing to the space after the „B‟ in the input stream
first middle last
first middle last
16
17
i ch
i ch
i ch
i ch
NOTE: shows the location of the file reading marker STATEMENTS CONTENTS MARKER POSITION int i; A 22 B 16 C 19\n char ch;
cin >> ch; A 22 B 16 C 19\n
cin.ignore(100, „B‟); A 22 B 16 C 19\n
cin >> i; A 22 B 16 C 19\n 19
20