1IntroductiontoComputersandC++Programming
1.1Introduction
1.2WhatisaComputer?
1.3ComputerOrganization
1.4EvolutionofOperatingSystems
1.5PersonalComputing,DistributedComputingandClienffServerComputing
1.6MachineLanguages,AssemblyLanguages,andHigh-levelLanguages
1.7HistoryofCandC++
1.8C++StandardLibrary
1.9Java
1.10VisualBasic,VisualC++andC#
1.11OtherHigh-levelLanguages
1.12StructuredProgramming
1.13TheKeySoftwareTrend:ObjectTechnology
1.14BasicsofaTypicalC++Environment
1.15HardwareTrends
1.16HistoryoftheIntemet
1.17HistoryoftheWorldWideWeb
1.18WorldWideWebConsortium(W3C)
1.19GeneralNotesAboutC++andThisBook
1.20IntroductiontoC++Programming
1.21ASimpleProgram:PrintingaLineofText
1.22AnotherSimpleProgram:AddingTwoIntegers
1.23MemoryConcepts
1.24Arithmetic
1.25DecisionMaking:EqualityandRelationalOperators
1.26ThinkingAboutObjects:IntroductiontoObjectTechnologyandtheUnifiedModelingLanguage
1.27TouroftheBook
2ControlStructures
2.1Introduction
2.2Algorithms
2.3Pseudocode
2.4ControlStructures
2.5ifSelectionStructure
2.6if/elseSelectionStructure
2.7whileRepetitionStructure
2.8FormulatingAlgorithms:CaseStudy1(Counter-ControlledRepetition)
2.9FormulatingAlgorithmswithTop-Down,StepwiseRefinement:CaseStudy2(Sentinel-ControlledRepetition)
2.10FormulatingAlgorithmswithTop-Down,StepwiseRefinement:CaseStudy3(NestedControlStructures)
2.11AssignmentOperators
2.12IncrementandDecrementOperators
2.13EssentialsofCounter-ControlledRepetition
2.14forRepetitionStructure
2.15ExamplesUsingtheforStructure
2.16switchMultiple-SelectionStructure
2.17do/whileRepetitionStructure
2.18breakandcontinueStatements
2.19LogicalOperators
2.20ConfusingEquality(==)andAssignment(=)Operators
2.21Structured-ProgrammingSummary
2.22[OptionalCaseStudy]ThinkingAboutObjects:IdentifyingaSystem'sClassesfromaProblemStatement
3Functions
3.1Introduction
3.2ProgramComponentsinC++
3.3MathLibraryFunctions
3.4Functions
3.5FunctionDefinitions
3.6FunctionPrototypes
3.7HeaderFiles
3.8RandomNumberGeneration
3.9Example:GameofChanceandIntroducingenum
3.10StorageClasses
3.11ScopeRules
3.12Recursion
3.13ExampleUsingRecursion:FibonacciSeries
Recursionvs.Iteration
FunctionswithEmptyParameterLists
InlineFunctions
ReferencesandReferenceParameters
DefaultArguments
UnaryScopeResolutionOperator
FunctionOverloading
FunctionTemplates
[OptionalCaseStudy]ThinkingAboutObjects:Identifyinga
Class'sAttributes
Arrays
Introduction
Arrays
DeclaringArrays
ExamplesUsingArrays
PassingArraystoFunctions
SortingArrays
CaseStudy:ComputingMean,MedianandModeUsingArrays
SearchingArrays:LinearSearchandBinarySearch
Multiple-SubscriptedArrays
[OptionalCaseStudy]ThinkingAboutObjects:Identifyingthe
OperationsofaClass
PointersandStrings
Introduction
PointerVariableDeclarationsandInitialization
PoiuterOperators
CallingFunctionsbyReference
UsingconstwithPointers
BubbleSortUsingPass-by-Reference
PointerExpressionsandPointerArithmetic
RelationshipBetweenPointersandArrays
ArraysofPointers
CaseStudy:CardShufflingandDealingSimulation
FunctionPointers
IntroductiontoCharacterandStringProcessing
5.12.1FundamentalsofCharactersandStrings
5.12.2StringManipulationFunctionsoftheString-HandlingLibrary
5.13[OptionalCaseStudy]ThinkingAboutObjects:Collaborations
AmongObjects
6ClassesandDataAbstraction
6.1Introduction
6.2StructureDefinitions
6.3AccessingStructureMembers
ImplementingUser-DefinedTypeTimewithaC-likestruct
ImplementingAbstractDataTypeTimewithaclass
ClassScopeandAccessingClassMembers
SeparatingInterfacefromImplementation
ControllingAccesstoMembers
AccessFunctionsandUtilityFunctions
InitializingClassObjects:Constructors
UsingDefaultArgumentswithConstructors
Destructors
WhenConstructorsandDestructursAreCalled
UsingSetandGetFunctions
SubtleTrap:ReturningaReferencetoaprivateDataMember
DefaultMemberwiseAssignment
SoftwareReusability
[OptionalCaseStudy)ThinkingAboutObjects:StartingtoProgramtheClassesfortheElevatorSimulator
7Classes:PartII
7.1Introduction
7.2const(Constant)ObjectsandeonstMemberFunctions
7.3Composition:ObjectsasMembersofClasses
7.4friendFunctionsandfriendClasses
7.5UsingthethisPointer
7.6DynamicMemoryManagementwithOperatorsnewanddelete
7.7staticClassMembers
7.8DataAbstractionandInformationHiding
7.8.1Example:ArrayAbstractDataType
7.8.2Example:StringAbstractDataType
7.8.3Example:QueueAbstractDataType
7.9ContainerClassesandIterators
7.10ProxyClasses
7.11[OptionalCaseStudy]ThinkingAboutObjects:ProgrammingtheClassesfortheElevatorSimulator
8OperatorOverloading;StringandArrayObjects
8.1Introduction
8.2FundamentalsofOperatorOverloading
8.3RestrictionsonOperatorOverloading
8.4OperatorFunctionsasClassMembersvs.asfriendFunctions
8.5OverloadingStream-InsertionandStream-ExtractionOperators
8.6OverloadingUnaryOperators
8.7OverloadingBinaryOperators
8.8CaseStudy:ArrayClass
8.9ConvertingbetweenTypes
8.10CaseStudy:StringClass
8.11Overloading++and--
CaseStudy:ADateClass
StandardLibraryClassesstringandvector
Object-OrientedProgramming:Inheritance
Introduction
BaseClassesandDerivedClasses
protectedMembers
RelationshipbetweenBaseClassesandDerivedClasses
CaseStudy:Three-LevelInheritanceHierarchy
ConstructorsandDestructorsinDerivedClasses
“UsesA”and“KnowsA”Relationships
Dublic,protectedandprivateInheritance
SoftwareEngineeringwithInheritance
[OptionalCaseStudy]ThinkingAboutObjects:Incorporating
InheritanceintotheElevatorSimulation
10Object-OrientedProgramming:Polymorphism
10.1Introduction
10.2RelationshipsAmongObjectsinanInheritanceHierarchy
10.2.1InvokingBase-ClassFunctionsfromDerived-ClassObjects
10.2.2AimingDerived-ClassPointersatBase-ClassObjects
10.2.3Derived-ClassMember-FunctionCallsviaBase-ClassPointers
10.2.4VirtualFunctions
10.3PolymorpbismExamples
10.4TypeFieldsandswitchStructures
10.5AbstractClasses
10.6CaseStudy:InheritingInterfaceandImplementation
10.7Polymorphism,VirtualFunctionsandDynamicBinding"Under
theHood"
10.8VirtualDestructors
10.9CaseStudy:PayrollSystemUsingPolymorphismandRun-TimeTypeInformationwithdynamicandtypeid
11Templates
11.1Introduction
11.2FunctionTemplates
11.3OverloadingFunctionTemplates
11.4ClassTemplates
11.5ClassTemplatesandNontypeParameters
11.6TemplatesandInheritance
11.7TemplatesandFriends
11.8TemplatesandstaticMembers
12C++StreamInput/Output
12.1Introduction
12.2Streams
12.2.1ClassicStreamsvs.StandardStreams
12.2.2iostreamLibraryHeaderFiles
12.2.3StreamInput/OutputClassesandObjects
12.3StreamOutput
12.3.1Outputofchar*Variables
12.3.2CharacterOutputusingMemberFunctionput
12.4StreamInput
12.4.1getandgetlineMemberFunctions
12.4.2istreamMemberFunctionspeek,putbackandignore
12.4.3Type-SafeI/O
12.5UnformattedI/Ousingread,writeandgcount
12.6IntroductiontoStreamManipulators
12.6.1IntegralStreamBase:dec,oct,hexandsetbase
12.6.2Floating-PointPrecision(precision,eetprecJ,eion)
12.6.3FieldWidth(width,setw)
12.6.4Programmer-DefinedManipulators
12.7StreamFormatStatesandStreamManipulators
12.7.1TrailingZerosandDecimalPoints(shovpoint)
12.7.2Justification(left,rightandinternal)
12.7.3Padding(fi11,setfill)
12.7.4IntegralStreamBase(dec,oct,hex,showbase)
12.7.5Floating-PointNumbers;ScientificandFixedNotation(scientific,fixed)
12.7.6Uppercase/LowercaseControl(uppercase)
12.7.7SpecifyingBooleanFormat(boolalpha)
12.7.8SettingandResettingtheFormatStateviaMemberFunctionflags
12.8StreamErrorStates
12.9TyinganOutputStreamtoanInputStream
15ExceptionHandling
13.1Introduction
13.2Exception-HandlingOverview
13.3OtherError-HandlingTechniques
13.4SimpleException-HandlingExample:DividebyZero
13.5RethrowinganException
13.6ExceptionSpecifications
13.7ProcessingUnexpectedExceptions
13.8StackUnwinding
13.9Constructors,DestructorsandExceptionHandling
13.10ExceptionsandInheritance
13.11ProcessingnewFailures
13.12Class&uto_ptrandDynamicMemoryAllocation
13.13StandardLibraryExceptionHierarchy
14FileProcessing
14.1Introduction
14.2TheDataHierarchy
14.3FilesandStreams
14.4CreatingaSequential-AccessFile
14.5ReadingDatafromaSequential-AccessFile
14.6UpdatingSequential-AccessFiles
14.7Random-AccessFiles
14.8CreatingaRandom-AccessFile
14.9WritingDataRandomlytoaRandom-AccessFile
14.10ReadingDataSequentiallyfromaRandom-AccessFile
14.11Example:ATransaction-ProcessingProgram
14.12Input/OutputofObjects
15ClassstringandStringStreamProcessing
15.1Introduction
15.2stringAssignmentandConcatenation
15.3Comparingstrings
15.4Substrings
15.5Swappingstrings
15.6stringCharacteristics
15.7FindingStringsandCharactersinastring
15.8ReplacingCharactersinastring
15.9InsertingCharactersintoastring
15.10ConversiontoC-Stylechar*Strings
15.11Iterators
15.12StringStreamProcessing
16WebProgrammingwithCOl
16.1Introduction
16.2HTTPRequestTypes
16.3Multi-TierArchitecture
16.4AccessingWebServers
16.5ApacheHTtPServer
16.6RequestingXHTMLDocuments
16.7IntroductiontoCGI
16.8SimpleHTTPTransaction
16.9SimpleCGIScript
16.10SendingInputtoaCGIScript
16.11UsingXHTMLFormstoSendInput
16.12OtherHeaders
16.13CaseStudy:AnInteractiveWebPage
16.14Cookies
16.15Server-SideFiles
16.16CaseStudy:ShoppingCart
16.17IntemetandWebResources
17DataStructures
17.1Introduction
17.2Self-ReferentialClasses
DynamicMemoryAllocationandDataStructures
LinkedLists
Stacks
Queues
Trees
Bits,Characters,StringsandStructures
Introduction
StructureDefinitions
InitializingStructures
UsingStructureswithFunctions
typedef
Example:High-PerformanceCard-ShufflingandDealingSimulation
BitwiseOperators
BitFields
Character-HandlingLibrary
18.10String-ConversionFunctions
18.11SearchFunctionsoftheString-HandlingLibrary
18.12MemoryFunctionsoftheString-HandlingLibrary
Preprocessor
Introduction
The#includePreprocessorDirective
The#definePreprocessorDirective:SymbolicConstants
The#definePreprocessorDirective:Macros
ConditionalCompilation
The#errorand#pragmaPreprocessorDirectives
The#and##Operators
LineNumbers
PredefinedSymbolicConstants
19.10Assertions
CLegacyCodeTopics
Introduction
RedirectingInput/OutputonUNIXandDOSSystems
Variable-LengthArgumentLists
UsingCommand-LineArguments
NotesonCompilingMultiple-Source-FilePrograms
ProgramTerminationwithexitandatexlt
ThevolaeileTypeQualifier
SuffixesforIntegerandFloating-PointConstants
SignalHandling
20.10DynamicMemoryAllocationwithcallocandreailoc
20.11TheUnconditionalBranch:goto
20.12Unions
20.13LinkageSpecifications
StandardTemplateLibrary(STL)
IntroductiontotheStandardTemplateLibrary(STL)
21.1.1IntroductiontoContainers
21.1.2IntroductiontoIterators
21.1.3IntroductiontoAlgorithms
SequenceContainers
21.2.1vectorSequenceContainer
21.2.2iistSequenceContainer
21.2.3clequeSequenceContainer
AssociativeContainers
21.3.1multisetAssociativeContainer
21.3.2set:AssociativeContainer
21.3.3multimapAssociativeContainer
21.3.4magAssociativeContainer
ContainerAdapters
21.4.1stackAdapter
21.4.2queueAdapter
21.4.3priority_queueAdapter
Algorithms
21.5.1fill,fill_n,generateandgenerate_n
21.5.2equal,mismatchandlexicographical_compare
21.5.3remove,remove_if,remove_copyandremove_copy_if
21.5.4replace,replace_if,replace_copyandreplace_copy_if
21.5.5MathematicalAlgorithms
21.5.6BasicSearchingandSortingAlgorithms
21.5.7swap,iter_swapandswap_ranges
21.5.8CODy_backward,merge,uniqueandreverse
21.5.9inplace_merge,unique_copyandreverse_color
21.5.10SetOperations
21.5.11lower_bound,uDDer_boundandequal_range
21.5.12Heapsort
21.5.13atinandmax
21.5.14AlgorithmsNotCoveredinThisChapter
Classbitset
FunctionObjects
STLIntemetandWebResources
OtherTopics
Introduction
constcastOperator
reinterpret_castOperator
namespaces
OperatorKeywords
explicitConstructors
22.7mutableClassMembers
22.8PointerstoClassMembers(.*and->*)
22.9MultipleInheritance
22.10MultipleInheritanceandrift:ualBaseClasses
22.11ClosingRemarks
OperatorPrecedenceChart
ASCIICharacterSet
NumberSystems
Introduction
AbbreviatingBinaryNumbersasOctalNumbersand
HexadecimalNumbers
ConvertingOctalNumbersandHexadecimalNumberstoBinaryNumbers
ConvertingfromBinary,OctalorHexadecimaltoDecimal
ConvertingfromDecimaltoBinary,OctalorHexadecimal
NegativeBinaryNumbers:Two'sComplementNotation
C++InternetandWebResources
Resources
Tutorials
FAQs
VisualC++
Newsgroups
CompilersandDevelopmentTools
StandardTemplateLibrary
IntroductiontoXHTML
Introduction
EditingXHTML
FirstXHTMLExample
Headers
Linking
Images
SpecialCharactersandMoreLineBreaks
UnorderedLists
NestedandOrderedLists
BasicXHTMLTables
IntermediateXHTMLTablesandFormatting
BasicXHTMLForms
MoreComplexXHTMLForms
IntemetandWorldWideWebResources
XHTMLSpecialCharacters
Bibliography
Index