#4 Console Input and Output

#4 Console Input and Output - Mapua Institute of Technology...

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

View Full Document Right Arrow Icon
Mapua Institute of Technology School of IT CS103 – Fundamentals of Problem Solving and Programming 1 Lecture #3 Input/Output Does C++ language include commands for input/output? NO, actually the C++ programming language by itself does not include commands for input/output of data, which is the <iostream> library. However, there is a pre-defined standard input/output library that can be linked with the programmer’s object file. What is the library command used for output of data? There are actually several of them, but we’ll learn to use first the cout<< statement. The syntax is: cout << <format string or an expression>; Example: cout << “Hello”; cout <<(x+y); In addition, it does not need a separate to copy of the object cout for each item output. Previous example can also be written as: cout<< “Hello” << (x+y); How to format numbers with a decimal point? If the computer outputs a value of type double, the format of the output might contain several number of decimal places as shown belown.
Background image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 3

#4 Console Input and Output - Mapua Institute of Technology...

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

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