




























































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 introduction to enumeration types and strings in C++ programming. It covers the definition, values, and operations on enumeration types, as well as the use of strings, string concatenation, and functions like swap and find. It also explains the difference between value and reference parameters in functions.
Typology: Slides
1 / 68
This page cannot be seen from the preview
Don't miss anything!





























































Dr. Mageda Sharafeddin
Objectives In this chapter, you will:
C++ Programming: Program Design Including Data Structures, Second Edition 4 Enumeration Type
C++ Programming: Program Design Including Data Structures, Second Edition 5 Enumeration Type (continued)
C++ Programming: Program Design Including Data Structures, Second Edition 7 Examples
C++ Programming: Program Design Including Data Structures, Second Edition 8 Declaring Variables
10 Operations
C++ Programming: Program Design Including Data Structures, Second Edition 11 Operations (continued)
Examples of legal enum operations enum sports {BASKETBALL, FOOTBALL, HOCKEY, BASEBALL, SOCCER, VOLLEYBALL}; sports popularSport, mySport; popularSport = FOOTBALL; popularSport = static_cast
Examples of legal enum operations enum sports {BASKETBALL, FOOTBALL, HOCKEY, BASEBALL, SOCCER, VOLLEYBALL}; FOOTBALL <= SOCCER HOCKEY > BASKETBALL BASEBALL < FOOTBALL for (mySport = BASKETBALL; mySport <= SOCCER; mySport = static_cast
-. -. -. C++ Programming: Program Design Including Data Structures, Second Edition 14
C++ Programming: Program Design Including Data Structures, Second Edition 16 Functions and Enumeration Types
Enumeration as input or output
C++ Programming: Program Design Including Data Structures, Second Edition 19 typedef Statement
20 ANSI/ISO Standard C++, Namespaces namespace namespace_name { members } namespace globalType { const int N = 10; const double RATE = 7.50; int count = 0; void printResult(); } globalType::RATE; globalType::printResult();