Example: dental hygienist

D R A F T - Southern Adventist University

Fundamentals of ProgrammingC++DRAFTR ichard L. HaltermanSchool of ComputingSouthern Adventist UniversityFebruary 28, 2018 Copyright 2008 2017 Richard L. Halterman. All rights The Context of Software .. Tools .. Programming with C++ ..62 Writing a C++ Structure of a Simple C++ Program .. , Compiling, and Running the Program .. of our simple program .. for simple C++ programs ..133 Values and Values .. and Assignment .. Integer Types .. Types .. Numeric Types .. Types .. Type Inference with auto .. Exercises ..334 Expressions and Arithmetic37 2017 Richard L. HaltermanDraft date: February 28, .. Type Expressions .. Precedence and Associativity .. and Warnings .. Errors .. Errors .. Errors .. Warnings .. Examples .. vs. Floating-point Numbers.

CONTENTS v 11.2.6 C Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .333 11.2.7 Command-line Arguments ...

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of D R A F T - Southern Adventist University

1 Fundamentals of ProgrammingC++DRAFTR ichard L. HaltermanSchool of ComputingSouthern Adventist UniversityFebruary 28, 2018 Copyright 2008 2017 Richard L. Halterman. All rights The Context of Software .. Tools .. Programming with C++ ..62 Writing a C++ Structure of a Simple C++ Program .. , Compiling, and Running the Program .. of our simple program .. for simple C++ programs ..133 Values and Values .. and Assignment .. Integer Types .. Types .. Numeric Types .. Types .. Type Inference with auto .. Exercises ..334 Expressions and Arithmetic37 2017 Richard L. HaltermanDraft date: February 28, .. Type Expressions .. Precedence and Associativity .. and Warnings .. Errors .. Errors .. Errors .. Warnings .. Examples .. vs. Floating-point Numbers.

2 Implementation .. Implementation .. Arithmetic Operators .. Bitwise Operators .. Algorithms .. Exercises ..785 Conditional bool .. Expressions .. Simple if Statement .. Statements .. if/else Statement .. Boolean Expressions .. Conditionals .. if/else Statements .. in Conditional Statements .. Exercises .. 1176 while Statement .. Loops .. Loop Termination .. 140 2017 Richard L. HaltermanDraft date: February 28, break statement .. goto Statement .. continue Statement .. Loops .. Examples .. a Tree .. Prime Numbers .. 1537 Other Conditional and Iterative switch Statement .. Conditional Operator .. do/while Statement .. for Statement .. 1738 Using to Using Functions.

3 Math Functions .. and Minimum .. Function .. Functions .. Numbers .. 1979 Writing Basics .. Functions .. by Value .. Examples .. Organized Prime Generator .. Interpreter .. Input .. Die Rolling Simulator .. Drawing Function .. 223 2017 Richard L. HaltermanDraft date: February 28, Equality .. Table with Functions .. Functions .. Functions vs. Standard Functions .. 23310 Managing Functions and Global Variables .. Static Variables .. Overloaded Functions .. Default Arguments .. Recursion .. Making Functions Reusable .. Pointers .. Reference Variables .. Pass by Reference .. Pass by Reference via Pointers .. Pass by Reference via References.

4 Functions .. 27811 Vectors .. Declaring and Using Vectors .. Traversing a Vector .. Vector Methods .. Vectors and Functions .. Multidimensional Vectors .. Arrays .. Static Arrays .. Pointers and Arrays .. Dynamic Arrays .. Copying an Array .. Multidimensional Arrays .. C Strings .. 331 2017 Richard L. HaltermanDraft date: February 28, Command-line Arguments .. Vectors vs. Arrays .. Prime Generation with a Vector .. Exercises .. 34212 Sorting and Sorting .. Flexible Sorting .. Search .. Linear Search .. Binary Search .. Vector Permutations .. Randomly Permuting a Vector .. Exercises .. 37913 Standard C++ String Objects.

5 Input/Output Streams .. File Streams .. Complex Numbers .. Better Pseudorandom Number Generation .. Exercises .. 40314 Custom Object Basics .. Instance Variables .. Member Functions .. Constructors .. Defining a New Numeric Type .. Encapsulation .. Exercises .. 42815 Fine Tuning Passing Object Parameters .. Pointers to Objects and Object Arrays .. ThethisPointer .. 440 2017 Richard L. HaltermanDraft date: February 28, .. Separating Method Declarations and Definitions .. Preventing Multiple Inclusion .. Overloaded Operators .. Operator Functions .. Operator Methods .. Classes vs. structs .. 46816 Building some Useful A Better Rational Number Class.

6 Stopwatch .. Sorting with Logging .. Automating Testing .. Convenient High-quality Pseudorandom Numbers .. Exercises .. 49117 Inheritance and I/O Stream Inheritance .. Inheritance Mechanics .. Uses of Inheritance .. Polymorphism .. Protected Members .. Fine Tuning Inheritance .. Exercises .. 52818 Memory Memory Available to C++Programs .. Manual Memory Management .. Linked Lists .. Resource Management .. Rvalue References .. Smart Pointers .. 577 2017 Richard L. HaltermanDraft date: February 28, 2018 CONTENTSvii19 Generic Function Templates .. Class Templates .. Exercises .. 61920 The Standard Template Containers .. Iterators.

7 Iterator Ranges .. Lambda Functions .. Algorithms in the Standard Library .. Namespaces .. 66121 Associative Associative Containers .. Thestd::setData Type .. Tuples .. Thestd::mapData Type .. Thestd::unordered_mapData Type .. Counting with Associative Containers .. Grouping with Associative Containers .. Memoization .. 69222 Handling Motivation .. Exception Examples .. Custom Exceptions .. Catching Multiple Exceptions .. Exception Mechanics .. Using Exceptions .. 716 Appendices721A Using Visual Studio 2015 to Develop C++ Programs721B Command Line Studio Command Line Tools .. 728 2017 Richard L. HaltermanDraft date: February 28, C++ Programs with the GNU Tools.

8 730 Bibliography732 Index733 2017 Richard L. HaltermanDraft date: February 28, 2018ixPrefaceLegal Notices and InformationPermission is hereby granted to make hardcopies and freely distribute the material herein under thefollowing conditions: The copyright and this legal notice must appear in any copies of this document made in whole or inpart. None of material herein can be sold or otherwise distributed for commercial purposes without writtenpermission of the copyright holder. Instructors at any educational institution may freely use this document in their classes as a primaryor optional textbook under the conditions specified local electronic copy of this document may be made under the terms specified for hard copies: The copyright and these terms of use must appear in any electronic representation of this documentmade in whole or in part.

9 None of material herein can be sold or otherwise distributed in an electronic form for commercialpurposes without written permission of the copyright holder. Instructors at any educational institution may freely store this document in electronic form on a localserver as a primary or optional textbook under the conditions specified , a hardcopy or a local electronic copy must contain the uniform resource locator (URL)providing a link to the original content so the reader can check for updated and corrected content. Thecurrent standard URL you are an instructor using this book in one or more of your courses, please let me know. Keeping track of howand where this book is used helps me justify to my employer that it is providing a useful service to the community andworthy of the time I spend working on it.

10 Simply send a message your name,your institution, and the course(s) in which you use source code for all labeled listings is available 2017 Richard L. HaltermanDraft date: February 28, 20181 Chapter 1 The Context of Software DevelopmentA computer program, from one perspective, is a sequence of instructions that dictate the flow of electri-cal impulses within a computer system. These impulses affect the computer s memory and interact withthe display screen, keyboard, mouse, and perhaps even other computers across a network in such a wayas to produce the magic that permits humans to perform useful tasks, solve high-level problems, andplay games. One program allows a computer to assume the role of a financial calculator, while anothertransforms the machine into a worthy chess opponent. Note the two extremes here: at the lower, more concrete level electrical impulses alter the internal state of the computer, while at the higher, more abstract level computer users accomplish real-world work or derive actual well is the higher-level illusion achieved that most computer users are oblivious to the lower-levelactivity (the machinery under the hood, so to speak).


Related search queries