L03_b_Intro to I_O - Input/Output (I/O) Input/Output (I/O)...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Input/Output (I/O) Input/Output (I/O) I/O streams Interactive I/O cin >> cout << EECS 183 University of Michigan Lecture 03 Mary Lou Dorf get getline Input and Output Input and Output For computation to be useful, it must : operate on data supplied to the program (input) present results to user or other program (output) I/O operations act on streams Infinite (conceptually) sequences of data elements tandard I/O streams comprise ASCII characters EECS 183 University of Michigan Lecture 03 Mary Lou Dorf Standard I/O streams comprise ASCII characters All I/O is in essence, done one character at a time Used for interactive I/O cout standard output stream typically associated with console window on primary display device (monitor) Standard I/O Standard I/O Streams Streams EECS 183 University of Michigan Lecture 03 Mary Lou Dorf cin standard input stream input received from keyboard typically echoed in console window #include <iostream> input data output data Interactive Interactive I/O using I/O using iostream iostream library library EECS 183 University of Michigan Lecture 03 Mary Lou Dorf cin ( type istream ) class cout ( type ostream ) class Keyboard Screen executing program Example Output Example Output cout << "Hello there world!"; Hello there world! EECS 183 University of Michigan Lecture 03 Mary Lou Dorf cout << "Hello there world!" << "C++ is amusing."; Hello there world!C++ is amusing. Example Output (2) Example Output (2) cout << "Hello there world!" << endl << "C++ is amusing."; Hello there world! C++ is amusing. EECS 183 University of Michigan Lecture 03 Mary Lou Dorf endl is an output manipulator generates a line feed when put to stream Example Output (3) Example Output (3) cout << "Hello there!" << endl << endl << "Bye"; prints Hello there! EECS 183 University of Michigan Lecture 03 Mary Lou Dorf Bye \n new line \t tab \b backspace rriage return Special Output Characters Special Output Characters EECS 183 University of Michigan Lecture 03 Mary Lou Dorf \r carriage return \' single quote \" double quote \\ backslash Example Output (4) Example Output (4) cout << "Hello \t and \n goodbye!" ; tab end of line ello nd EECS 183 University of Michigan Lecture 03 Mary Lou Dorf Hello and goodbye! Interactive Input: Interactive Input: Prompts Prompts #include <iostream> using namespace std; int main() { int length, width, area;...
View Full Document

This note was uploaded on 02/12/2010 for the course EECS 183 taught by Professor Dorf during the Fall '08 term at University of Michigan.

Page1 / 33

L03_b_Intro to I_O - Input/Output (I/O) Input/Output (I/O)...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online