Skip to Content
C++ How to Program, 10/e
book

C++ How to Program, 10/e

by Paul Deitel, Harvey Deitel
February 2016
Beginner
1080 pages
207h 57m
English
Pearson
Content preview from C++ How to Program, 10/e

... are distinct, the program declares one variable int and the other double.

Fig. 6.19 Unary scope resolution operator.

Alternate View

 1   // Fig. 6.19: fig06_19.cpp
 2   // Unary scope resolution operator.
 3   #include <iostream>
 4   using namespace std;
 5
 6   int number{7}; // global variable named number
 7
 8   int main() {
 9      double number{10.5}; // local variable named number 
10
11      // display values of local and global variables
12      cout << "Local double value of number = " << number
13         << "\nGlobal int value of number = " << ::number << endl;
14   }

Local double value of number = 10.5
Global int value of number = 7

Good Programming Practice 6.5

Always ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C++ How to Program, Sixth Edition

C++ How to Program, Sixth Edition

P. J. Deitel - Deitel & Associates, Inc., H. M. Deitel - Deitel & Associates, Inc.
C++ How to Program, Ninth Edition

C++ How to Program, Ninth Edition

Paul Deitel, Harvey Deitel

Publisher Resources

ISBN: 9780134448930Purchase book