A Taste of C++: 7.1 The Function 7.2 The and Streams 7.3 Comments 7.4 References
A Taste of C++: 7.1 The Function 7.2 The and Streams 7.3 Comments 7.4 References
Chapter 7
A Taste of C++
Chapter Overview
Page 2 Chapter 7: A Taste of C++ © Christian Jacob
#include <iostream.h>
void main()
{
int pounds;
float kilos;
directive
directive # include
< “
> “
compound
statement { }
declaration statement
statement expression ;
declaration
type identifier ;
const = expression
type
Streams
Hello, Universe!
Hello, Universe!
cout
cin
C++ program:
First Back TOC The cout and cin Streams Prev Next Last
Page 7 Chapter 7: A Taste of C++ © Christian Jacob
The objects cout and cin are streams, structures that hold data
temporarily.
First Back TOC The cout and cin Streams Prev Next Last
Page 8 Chapter 7: A Taste of C++ © Christian Jacob
7.3 Comments
void main()
{
int pounds; // weight in pounds (user input)
float kilos; // metric weight -- real number (output)
7.4 References