C++程序设计(第8版 影印版)

C++程序设计(第8版 影印版)
分享
扫描下方二维码分享到微信
打开微信,点击右上角”+“,
使用”扫一扫“即可将网页分享到朋友圈。
作者: [美]
2015-01
版次: 8
ISBN: 9787302386445
定价: 89.00
装帧: 平装
开本: 16开
纸张: 胶版纸
页数: 1060页
字数: 1281千字
正文语种: 英语
原版书名: Problem Solving with C++(8th Edition)
18人买过
  •   《C++程序设计(第8版 影印版)》是最优秀的C++入门教材,深受师生欢迎。作者结合自己多年的教学经验,根据教学大纲精心设计并编写了书中内容。与此同时,本书还采用了很多便于读者巩固所学知识的教学特征,比如各章开始处的小节总览,书中随处可见的总结框、编程提示和编程陷阱,各章结尾处的小结、习题和编程项目等。这些非常适合初学者掌握重要的编程概念。  《C++程序设计(第8版 影印版)》共18章,8个附录。在讲解C++基础知识之后,直接引导学生深入函数、I/O流、类、控制流程、命名空间、数组、字符串、指针和动态数组、递归、模板、指针和链表、派生类、异常以及标准模板库。  Original edition, entitled PROBLEM SOLVING WITH C++, 8E, 9780132162739 by SAVITCH,  WALTER, published by Pearson Education, Inc, publishing as Addison-Wesley, Copyright ? 2012 Pearson Education, Inc..  All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording or by any information storage retrieval system, without permission from Pearson Education, Inc.  China edition published by PEARSON EDUCATION ASIA LTD., and TSINGHUA UNIVERSITY PRESS LIMITED Copyright ? 2014.  This edition is manufactured in the People’s Republic of China, and is authorized for sale and distribution in the People’s Republic of China exclusively (except Taiwan, Hong Kong SAR and Macau SAR).  《C++程序设计(第8版 影印版)》影印版由Pearson Education授权给清华大学出版社在中国境内(不包括中国台湾、香港特别行政区和澳门特别行政区)出版发行。   WalterSavitch,美国加州大学圣地亚哥分校荣誉退休教授,拥有加州大学伯克利分校博士学位,曾担任加州大学圣地亚哥分校计算机科学系教授和认知科学跨学科博士项目主任。他在复杂性理论和并行计算模型方面具有卓越的贡献,其研究领域包括形式语言理论计算语言学等。Savitch教授还是C++和Java经典教材的缔造者,他的作品通俗易懂,生动有趣,贴近生活,应用性和实用性很强,深受全球数十万读者(包括教师和学生)的欢迎。 BriefContents
    TableofLocationofVideoNotes
    Insidefrontcoverandinsidebackcover
    Chapter11IntroductiontoComputersandC++Programming1
    Chapter22C++Basics39
    Chapter33MoreFlowofControl109
    Chapter44ProceduralAbstractionandFunctionsThatReturnaValue177
    Chapter55FunctionsforAllSubtasks247
    Chapter66I/OStreamsasanIntroductiontoObjectsandClasses301
    Chapter77Arrays373
    Chapter88StringsandVectors441
    Chapter99PointersandDynamicArrays493
    Chapter100DefiningClasses525
    Chapter11Friends,OverloadedOperators,andArraysinClasses601
    Chapter12SeparateCompilationandNamespaces685
    Chapter13PointersandLinkedLists721
    Chapter14Recursion769
    Chapter15Inheritance811
    Chapter16ExceptionHandling867
    Chapter17Templates899
    Chapter18StandardTemplateLibrary931
    Appendices
    1C++Keywords987
    2PrecedenceofOperators988
    3TheASCIICharacterSet990
    4SomeLibraryFunctions991
    5InlineFunctions998
    6OverloadingtheArrayIndexSquareBrackets999
    7ThethisPointer1001
    8OverloadingOperatorsasMemberOperators1004
    TableofLocationofVideoNotes
    Insidefrontcoverandinsidebackcover
    Chapter11IntroductiontoComputersandC++Programming1
    1.1COMPuTERSYSTEMS2
    Hardware2
    Software7
    High-LevelLanguages8
    Compilers9
    HistoryNote12
    1.2PROgRAMMINgANDPROBLEM-SOLVINg12
    Algorithms12
    ProgramDesign15
    Object-OrientedProgramming16
    TheSoftwareLifeCycle17
    1.3INTRODuCTIONTOC++18
    OriginsoftheC++Language18
    ASampleC++Program19
    Pitfall:UsingtheWrongSlashin\n23
    ProgrammingTip:InputandOutputSyntax23
    LayoutofaSimpleC++Program24
    Pitfall:PuttingaSpaceBeforetheincludeFileName26
    CompilingandRunningaC++Program26
    ProgrammingTip:GettingYourProgramtoRun27
    1.4TESTINgANDDEBuggINg29
    KindsofProgramErrors30
    Pitfall:AssumingYourProgramIsCorrect31
    ChapterSummary31
    1AnswerstoSelf-TestExercises32
    2ProgrammingProjects35
    Chapter2C++Basics39
    2.1VARIABLESANDASSIgNMENTS40
    Variables40
    0Names:Identifiers42
    2VariableDeclarations44
    4AssignmentStatements45
    5Pitfall:UninitializedVariables47
    7ProgrammingTip:UseMeaningfulNames49
    2.2INPuTANDOuTPuT50
    OutputUsingcout50
    IncludeDirectivesandNamespaces52
    EscapeSequences53
    ProgrammingTip:EndEachProgramwitha\norendl54
    FormattingforNumberswithaDecimalPoint55InputUsingcin56
    DesigningInputandOutput58
    ProgrammingTip:LineBreaksinI/O58
    2.3DATATYPESANDExPRESSIONS60
    TheTypesintanddouble60
    0OtherNumberTypes62
    2TheTypechar63
    3TheTypebool64
    4IntroductiontotheClassstring65
    5TypeCompatibilities66
    6ArithmeticOperatorsandExpressions68
    8Pitfall:WholeNumbersinDivision71
    1MoreAssignmentStatements73
    2.4SIMPLEFLOwOFCONTROL73
    ASimpleBranchingMechanism74
    4Pitfall:StringsofInequalities79
    9Pitfall:Using=inplaceof==80
    0CompoundStatements81
    1SimpleLoopMechanisms83
    IncrementandDecrementOperators86
    ProgrammingExample:ChargeCardBalance88
    Pitfall:InfiniteLoops89
    2.5PROgRAMSTYLE92
    Indenting92Comments92NamingConstants94
    ChapterSummary97AnswerstoSelf-TestExercises97
    ProgrammingProjects102
    Chapter3MoreFlowofControl109
    3.1uSINgBOOLEANExPRESSIONS110
    EvaluatingBooleanExpressions110
    Pitfall:BooleanExpressionsConverttointValues114
    EnumerationTypes(Optional)117
    3.2MuLTIwAYBRANCHES118
    NestedStatements118
    ProgrammingTip:UseBracesinNestedStatements119
    Multiwayif-elseStatements121
    ProgrammingExample:StateIncomeTax123
    TheswitchStatement126
    Pitfall:ForgettingabreakinaswitchStatement130
    UsingswitchStatementsforMenus131
    Blocks133
    Pitfall:InadvertentLocalVariables136
    3.3MOREABOuTC++LOOPSTATEMENTS137
    ThewhileStatementsReviewed137
    IncrementandDecrementOperatorsRevisited139
    TheforStatement142
    Pitfall:ExtraSemicoloninaforStatement147
    WhatKindofLooptoUse148
    Pitfall:UninitializedVariablesandInfiniteLoops150
    ThebreakStatement151Pitfall:ThebreakStatementinNestedLoops152
    7387_Savitch_FM_ppi-xxx.indd182/2/115:45PM
    contentsxix
    3.4DESIgNINgLOOPS153
    LoopsforSumsandProducts153EndingaLoop155NestedLoops158DebuggingLoops160
    ChapterSummary163AnswerstoSelf-TestExercises164ProgrammingProjects170
    Chapter44ProceduralAbstractionandFunctionsThatReturnaValue177
    4.1TOP-DOwNDESIgN178
    4.2PREDEFINEDFuNCTIONS179
    UsingPredefinedFunctions179RandomNumberGeneration184TypeCasting186OlderFormofTypeCasting188Pitfall:IntegerDivisionDropstheFractionalPart188
    4.3PROgRAMMER-DEFINEDFuNCTIONS189
    FunctionDefinitions189FunctionsThatReturnaBooleanValue195AlternateFormforFunctionDeclarations195Pitfall:ArgumentsintheWrongOrder196FunctionDefinition–SyntaxSummary197MoreAboutPlacementofFunctionDefinitions198ProgrammingTip:UseFunctionCallsinBranchingStatements199
    4.4PROCEDuRALABSTRACTION200
    TheBlack-BoxAnalogy200ProgrammingTip:ChoosingFormalParameterNames203ProgrammingTip:NestedLoops204CaseStudy:BuyingPizza207ProgrammingTip:UsePseudocode213
    4.5SCOPEANDLOCALVARIABLES214
    TheSmallProgramAnalogy214ProgrammingExample:ExperimentalPeaPatch217
    GlobalConstantsandGlobalVariables217Call-by-ValueFormalParametersAreLocalVariables220BlockScope222NamespacesRevisited223ProgrammingExample:TheFactorialFunction226
    4.6OVERLOADINgFuNCTIONNAMES228
    IntroductiontoOverloading228ProgrammingExample:RevisedPizza-BuyingProgram231AutomaticTypeConversion234ChapterSummary236AnswerstoSelf-TestExercises236ProgrammingProjects241
    Chapter5FunctionsforAllSubtasks247
    5.1voidFuNCTIONS248
    DefinitionsofvoidFunctions248ProgrammingExample:ConvertingTemperatures251returnStatementsinvoidFunctions251
    5.2CALL-BY-REFERENCEPARAMETERS255
    AFirstViewofCall-by-Reference255Call-by-ReferenceinDetail258ProgrammingExample:Theswap_valuesFunction263MixedParameterLists264ProgrammingTip:WhatKindofParametertoUse265Pitfall:InadvertentLocalVariables266
    5.3uSINgPROCEDuRALABSTRACTION269
    FunctionsCallingFunctions269PreconditionsandPostconditions271CaseStudy:SupermarketPricing272
    5.4TESTINgANDDEBuggINgFuNCTIONS277
    StubsandDrivers278
    5.5gENERALDEBuggINgTECHNIquES283
    KeepanOpenMind283CheckCommonErrors283LocalizetheError284TheassertMacro2862/2/115:45PM
    ChapterSummary288
    8AnswerstoSelf-TestExercises289
    9ProgrammingProjects292
    Chapter66I/OStreamsasanIntroductiontoObjectsandClasses301
    6.1STREAMSANDBASICFILEI/O302
    WhyUseFilesforI/O?303
    3FileI/O304
    4IntroductiontoClassesandObjects308
    8ProgrammingTip:CheckWhetheraFileWasOpened
    dSuccessfully310
    0TechniquesforFileI/O312
    2AppendingtoaFile(Optional)316
    6FileNamesasInput(Optional)317
    6.2TOOLSFORSTREAMI/O319
    FormattingOutputwithStreamFunctions319
    9Manipulators325
    5StreamsasArgumentstoFunctions328
    8ProgrammingTip:CheckingfortheEndofaFile328
    8ANoteonNamespaces331
    1ProgrammingExample:CleaningUpaFileFormat332
    6.3CHARACTERI/O334
    TheMemberFunctionsgetandput334
    4TheputbackMemberFunction(Optional)338
    8ProgrammingExample:CheckingInput339
    9Pitfall:Unexpected'\n'inInput341
    1ProgrammingExample:Anothernew_lineFunction343
    3DefaultArgumentsforFunctions(Optional)344
    4TheeofMemberFunction349
    9ProgrammingExample:EditingaTextFile351
    1PredefinedCharacterFunctions352
    2Pitfall:toupperandtolowerReturnValues354
    ChapterSummary356
    6AnswerstoSelf-TestExercises357
    7ProgrammingProjects364
    Chapter7Arrays373
    7.1INTRODuCTIONTOARRAYS374
    DeclaringandReferencingArrays374ProgrammingTip:UseforLoopswithArrays376Pitfall:ArrayIndexesAlwaysStartwithZero376ProgrammingTip:UseaDefinedConstantfortheSizeofanArray376ArraysinMemory378Pitfall:ArrayIndexOutofRange379InitializingArrays381
    7.2ARRAYSINFuNCTIONS383
    IndexedVariablesasFunctionArguments383EntireArraysasFunctionArguments385TheconstParameterModifier388Pitfall:InconsistentUseofconstParameters391FunctionsThatReturnanArray391CaseStudy:ProductionGraph392
    7.3PROgRAMMINgwITHARRAYS405
    PartiallyFilledArrays405ProgrammingTip:DoNotSkimponFormalParameters408ProgrammingExample:SearchinganArray408ProgrammingExample:SortinganArray411
    7.4MuLTIDIMENSIONALARRAYS415
    MultidimensionalArrayBasics416MultidimensionalArrayParameters416ProgrammingExample:Two-DimensionalGradingProgram418Pitfall:UsingCommasBetweenArrayIndexes422
    ChapterSummary423AnswerstoSelf-TestExercises424ProgrammingProjects428
    Chapter8StringsandVectors441
    8.1ANARRAYTYPEFORSTRINgS443
    C-StringValuesandC-StringVariables443Pitfall:Using=and==withCStrings4462/2/115:45PM
    contentsxxiii
    OtherFunctionsin448
    8C-StringInputandOutput453
    3C-String-to-NumberConversionsandRobustInput455
    8.2THESTANDARDstringCLASS461
    IntroductiontotheStandardClassstring461
    1I/OwiththeClassstring464
    4ProgrammingTip:MoreVersionsofgetline467
    7Pitfall:Mixingcin>>variable;andgetline468
    8StringProcessingwiththeClassstring469
    9ProgrammingExample:PalindromeTesting473
    3ConvertingBetweenstringObjectsandCStrings476
    8.3VECTORS477
    VectorBasics477Pitfall:UsingSquareBracketsBeyondtheVectorSize480ProgrammingTip:VectorAssignmentIsWellBehaved481EfficiencyIssues481
    ChapterSummary483
    3AnswerstoSelf-TestExercises484
    4ProgrammingProjects486
    Chapter9PointersandDynamicArrays493
    9.1POINTERS494
    PointerVariables495
    5BasicMemoryManagement502
    2Pitfall:DanglingPointers503
    3StaticVariablesandAutomaticVariables504
    4ProgrammingTip:DefinePointerTypes504
    9.2DYNAMICARRAYS507
    ArrayVariablesandPointerVariables507
    7CreatingandUsingDynamicArrays508
    8PointerArithmetic(Optional)514
    4MultidimensionalDynamicArrays(Optional)516
    ChapterSummary518
    8AnswerstoSelf-TestExercises518
    8ProgrammingProjects519
    Chapter100DefiningClasses525
    10.1STRuCTuRES526
    StructuresforDiverseData526
    Pitfall:ForgettingaSemicoloninaStructureDefinition531
    StructuresasFunctionArguments532
    ProgrammingTip:UseHierarchicalStructures533
    InitializingStructures535
    10.2CLASSES538
    DefiningClassesandMemberFunctions538PublicandPrivateMembers543ProgrammingTip:MakeAllMemberVariablesPrivate551ProgrammingTip:DefineAccessorandMutatorFunctions551ProgrammingTip:UsetheAssignmentOperatorwithObjects553ProgrammingExample:BankAccountClass—Version1554SummaryofSomePropertiesofClasses558ConstructorsforInitialization560ProgrammingTip:AlwaysIncludeaDefaultConstructor568Pitfall:ConstructorswithNoArguments569
    10.3ABSTRACTDATATYPES571
    ClassestoProduceAbstractDataTypes572ProgrammingExample:AlternativeImplementationofaClass576
    10.4INTRODuCTIONTOINHERITANCE581
    DerivedClasses582DefiningDerivedClasses583
    ChapterSummary587AnswerstoSelf-TestExercises588ProgrammingProjects594
    Chapter111Friends,OverloadedOperators,andArraysinClasses601
    11.1FRIENDFuNCTIONS602
    ProgrammingExample:AnEqualityFunction602FriendFunctions606ProgrammingTip:DefineBothAccessorFunctionsandFriendFunctions6082/2/115:45PM
    contentsxxv
    ProgrammingTip:UseBothMemberandNonmemberFunctions610ProgrammingExample:MoneyClass(Version1)610Implementationofdigit_to_int(Optional)617Pitfall:LeadingZerosinNumberConstants618TheconstParameterModifier620Pitfall:InconsistentUseofconst621
    11.2OVERLOADINgOPERATORS625
    OverloadingOperators626
    6ConstructorsforAutomaticTypeConversion629
    9OverloadingUnaryOperators631
    1Overloading>>and
  • 内容简介:
      《C++程序设计(第8版 影印版)》是最优秀的C++入门教材,深受师生欢迎。作者结合自己多年的教学经验,根据教学大纲精心设计并编写了书中内容。与此同时,本书还采用了很多便于读者巩固所学知识的教学特征,比如各章开始处的小节总览,书中随处可见的总结框、编程提示和编程陷阱,各章结尾处的小结、习题和编程项目等。这些非常适合初学者掌握重要的编程概念。  《C++程序设计(第8版 影印版)》共18章,8个附录。在讲解C++基础知识之后,直接引导学生深入函数、I/O流、类、控制流程、命名空间、数组、字符串、指针和动态数组、递归、模板、指针和链表、派生类、异常以及标准模板库。  Original edition, entitled PROBLEM SOLVING WITH C++, 8E, 9780132162739 by SAVITCH,  WALTER, published by Pearson Education, Inc, publishing as Addison-Wesley, Copyright ? 2012 Pearson Education, Inc..  All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording or by any information storage retrieval system, without permission from Pearson Education, Inc.  China edition published by PEARSON EDUCATION ASIA LTD., and TSINGHUA UNIVERSITY PRESS LIMITED Copyright ? 2014.  This edition is manufactured in the People’s Republic of China, and is authorized for sale and distribution in the People’s Republic of China exclusively (except Taiwan, Hong Kong SAR and Macau SAR).  《C++程序设计(第8版 影印版)》影印版由Pearson Education授权给清华大学出版社在中国境内(不包括中国台湾、香港特别行政区和澳门特别行政区)出版发行。
  • 作者简介:
      WalterSavitch,美国加州大学圣地亚哥分校荣誉退休教授,拥有加州大学伯克利分校博士学位,曾担任加州大学圣地亚哥分校计算机科学系教授和认知科学跨学科博士项目主任。他在复杂性理论和并行计算模型方面具有卓越的贡献,其研究领域包括形式语言理论计算语言学等。Savitch教授还是C++和Java经典教材的缔造者,他的作品通俗易懂,生动有趣,贴近生活,应用性和实用性很强,深受全球数十万读者(包括教师和学生)的欢迎。
  • 目录:
    BriefContents
    TableofLocationofVideoNotes
    Insidefrontcoverandinsidebackcover
    Chapter11IntroductiontoComputersandC++Programming1
    Chapter22C++Basics39
    Chapter33MoreFlowofControl109
    Chapter44ProceduralAbstractionandFunctionsThatReturnaValue177
    Chapter55FunctionsforAllSubtasks247
    Chapter66I/OStreamsasanIntroductiontoObjectsandClasses301
    Chapter77Arrays373
    Chapter88StringsandVectors441
    Chapter99PointersandDynamicArrays493
    Chapter100DefiningClasses525
    Chapter11Friends,OverloadedOperators,andArraysinClasses601
    Chapter12SeparateCompilationandNamespaces685
    Chapter13PointersandLinkedLists721
    Chapter14Recursion769
    Chapter15Inheritance811
    Chapter16ExceptionHandling867
    Chapter17Templates899
    Chapter18StandardTemplateLibrary931
    Appendices
    1C++Keywords987
    2PrecedenceofOperators988
    3TheASCIICharacterSet990
    4SomeLibraryFunctions991
    5InlineFunctions998
    6OverloadingtheArrayIndexSquareBrackets999
    7ThethisPointer1001
    8OverloadingOperatorsasMemberOperators1004
    TableofLocationofVideoNotes
    Insidefrontcoverandinsidebackcover
    Chapter11IntroductiontoComputersandC++Programming1
    1.1COMPuTERSYSTEMS2
    Hardware2
    Software7
    High-LevelLanguages8
    Compilers9
    HistoryNote12
    1.2PROgRAMMINgANDPROBLEM-SOLVINg12
    Algorithms12
    ProgramDesign15
    Object-OrientedProgramming16
    TheSoftwareLifeCycle17
    1.3INTRODuCTIONTOC++18
    OriginsoftheC++Language18
    ASampleC++Program19
    Pitfall:UsingtheWrongSlashin\n23
    ProgrammingTip:InputandOutputSyntax23
    LayoutofaSimpleC++Program24
    Pitfall:PuttingaSpaceBeforetheincludeFileName26
    CompilingandRunningaC++Program26
    ProgrammingTip:GettingYourProgramtoRun27
    1.4TESTINgANDDEBuggINg29
    KindsofProgramErrors30
    Pitfall:AssumingYourProgramIsCorrect31
    ChapterSummary31
    1AnswerstoSelf-TestExercises32
    2ProgrammingProjects35
    Chapter2C++Basics39
    2.1VARIABLESANDASSIgNMENTS40
    Variables40
    0Names:Identifiers42
    2VariableDeclarations44
    4AssignmentStatements45
    5Pitfall:UninitializedVariables47
    7ProgrammingTip:UseMeaningfulNames49
    2.2INPuTANDOuTPuT50
    OutputUsingcout50
    IncludeDirectivesandNamespaces52
    EscapeSequences53
    ProgrammingTip:EndEachProgramwitha\norendl54
    FormattingforNumberswithaDecimalPoint55InputUsingcin56
    DesigningInputandOutput58
    ProgrammingTip:LineBreaksinI/O58
    2.3DATATYPESANDExPRESSIONS60
    TheTypesintanddouble60
    0OtherNumberTypes62
    2TheTypechar63
    3TheTypebool64
    4IntroductiontotheClassstring65
    5TypeCompatibilities66
    6ArithmeticOperatorsandExpressions68
    8Pitfall:WholeNumbersinDivision71
    1MoreAssignmentStatements73
    2.4SIMPLEFLOwOFCONTROL73
    ASimpleBranchingMechanism74
    4Pitfall:StringsofInequalities79
    9Pitfall:Using=inplaceof==80
    0CompoundStatements81
    1SimpleLoopMechanisms83
    IncrementandDecrementOperators86
    ProgrammingExample:ChargeCardBalance88
    Pitfall:InfiniteLoops89
    2.5PROgRAMSTYLE92
    Indenting92Comments92NamingConstants94
    ChapterSummary97AnswerstoSelf-TestExercises97
    ProgrammingProjects102
    Chapter3MoreFlowofControl109
    3.1uSINgBOOLEANExPRESSIONS110
    EvaluatingBooleanExpressions110
    Pitfall:BooleanExpressionsConverttointValues114
    EnumerationTypes(Optional)117
    3.2MuLTIwAYBRANCHES118
    NestedStatements118
    ProgrammingTip:UseBracesinNestedStatements119
    Multiwayif-elseStatements121
    ProgrammingExample:StateIncomeTax123
    TheswitchStatement126
    Pitfall:ForgettingabreakinaswitchStatement130
    UsingswitchStatementsforMenus131
    Blocks133
    Pitfall:InadvertentLocalVariables136
    3.3MOREABOuTC++LOOPSTATEMENTS137
    ThewhileStatementsReviewed137
    IncrementandDecrementOperatorsRevisited139
    TheforStatement142
    Pitfall:ExtraSemicoloninaforStatement147
    WhatKindofLooptoUse148
    Pitfall:UninitializedVariablesandInfiniteLoops150
    ThebreakStatement151Pitfall:ThebreakStatementinNestedLoops152
    7387_Savitch_FM_ppi-xxx.indd182/2/115:45PM
    contentsxix
    3.4DESIgNINgLOOPS153
    LoopsforSumsandProducts153EndingaLoop155NestedLoops158DebuggingLoops160
    ChapterSummary163AnswerstoSelf-TestExercises164ProgrammingProjects170
    Chapter44ProceduralAbstractionandFunctionsThatReturnaValue177
    4.1TOP-DOwNDESIgN178
    4.2PREDEFINEDFuNCTIONS179
    UsingPredefinedFunctions179RandomNumberGeneration184TypeCasting186OlderFormofTypeCasting188Pitfall:IntegerDivisionDropstheFractionalPart188
    4.3PROgRAMMER-DEFINEDFuNCTIONS189
    FunctionDefinitions189FunctionsThatReturnaBooleanValue195AlternateFormforFunctionDeclarations195Pitfall:ArgumentsintheWrongOrder196FunctionDefinition–SyntaxSummary197MoreAboutPlacementofFunctionDefinitions198ProgrammingTip:UseFunctionCallsinBranchingStatements199
    4.4PROCEDuRALABSTRACTION200
    TheBlack-BoxAnalogy200ProgrammingTip:ChoosingFormalParameterNames203ProgrammingTip:NestedLoops204CaseStudy:BuyingPizza207ProgrammingTip:UsePseudocode213
    4.5SCOPEANDLOCALVARIABLES214
    TheSmallProgramAnalogy214ProgrammingExample:ExperimentalPeaPatch217
    GlobalConstantsandGlobalVariables217Call-by-ValueFormalParametersAreLocalVariables220BlockScope222NamespacesRevisited223ProgrammingExample:TheFactorialFunction226
    4.6OVERLOADINgFuNCTIONNAMES228
    IntroductiontoOverloading228ProgrammingExample:RevisedPizza-BuyingProgram231AutomaticTypeConversion234ChapterSummary236AnswerstoSelf-TestExercises236ProgrammingProjects241
    Chapter5FunctionsforAllSubtasks247
    5.1voidFuNCTIONS248
    DefinitionsofvoidFunctions248ProgrammingExample:ConvertingTemperatures251returnStatementsinvoidFunctions251
    5.2CALL-BY-REFERENCEPARAMETERS255
    AFirstViewofCall-by-Reference255Call-by-ReferenceinDetail258ProgrammingExample:Theswap_valuesFunction263MixedParameterLists264ProgrammingTip:WhatKindofParametertoUse265Pitfall:InadvertentLocalVariables266
    5.3uSINgPROCEDuRALABSTRACTION269
    FunctionsCallingFunctions269PreconditionsandPostconditions271CaseStudy:SupermarketPricing272
    5.4TESTINgANDDEBuggINgFuNCTIONS277
    StubsandDrivers278
    5.5gENERALDEBuggINgTECHNIquES283
    KeepanOpenMind283CheckCommonErrors283LocalizetheError284TheassertMacro2862/2/115:45PM
    ChapterSummary288
    8AnswerstoSelf-TestExercises289
    9ProgrammingProjects292
    Chapter66I/OStreamsasanIntroductiontoObjectsandClasses301
    6.1STREAMSANDBASICFILEI/O302
    WhyUseFilesforI/O?303
    3FileI/O304
    4IntroductiontoClassesandObjects308
    8ProgrammingTip:CheckWhetheraFileWasOpened
    dSuccessfully310
    0TechniquesforFileI/O312
    2AppendingtoaFile(Optional)316
    6FileNamesasInput(Optional)317
    6.2TOOLSFORSTREAMI/O319
    FormattingOutputwithStreamFunctions319
    9Manipulators325
    5StreamsasArgumentstoFunctions328
    8ProgrammingTip:CheckingfortheEndofaFile328
    8ANoteonNamespaces331
    1ProgrammingExample:CleaningUpaFileFormat332
    6.3CHARACTERI/O334
    TheMemberFunctionsgetandput334
    4TheputbackMemberFunction(Optional)338
    8ProgrammingExample:CheckingInput339
    9Pitfall:Unexpected'\n'inInput341
    1ProgrammingExample:Anothernew_lineFunction343
    3DefaultArgumentsforFunctions(Optional)344
    4TheeofMemberFunction349
    9ProgrammingExample:EditingaTextFile351
    1PredefinedCharacterFunctions352
    2Pitfall:toupperandtolowerReturnValues354
    ChapterSummary356
    6AnswerstoSelf-TestExercises357
    7ProgrammingProjects364
    Chapter7Arrays373
    7.1INTRODuCTIONTOARRAYS374
    DeclaringandReferencingArrays374ProgrammingTip:UseforLoopswithArrays376Pitfall:ArrayIndexesAlwaysStartwithZero376ProgrammingTip:UseaDefinedConstantfortheSizeofanArray376ArraysinMemory378Pitfall:ArrayIndexOutofRange379InitializingArrays381
    7.2ARRAYSINFuNCTIONS383
    IndexedVariablesasFunctionArguments383EntireArraysasFunctionArguments385TheconstParameterModifier388Pitfall:InconsistentUseofconstParameters391FunctionsThatReturnanArray391CaseStudy:ProductionGraph392
    7.3PROgRAMMINgwITHARRAYS405
    PartiallyFilledArrays405ProgrammingTip:DoNotSkimponFormalParameters408ProgrammingExample:SearchinganArray408ProgrammingExample:SortinganArray411
    7.4MuLTIDIMENSIONALARRAYS415
    MultidimensionalArrayBasics416MultidimensionalArrayParameters416ProgrammingExample:Two-DimensionalGradingProgram418Pitfall:UsingCommasBetweenArrayIndexes422
    ChapterSummary423AnswerstoSelf-TestExercises424ProgrammingProjects428
    Chapter8StringsandVectors441
    8.1ANARRAYTYPEFORSTRINgS443
    C-StringValuesandC-StringVariables443Pitfall:Using=and==withCStrings4462/2/115:45PM
    contentsxxiii
    OtherFunctionsin448
    8C-StringInputandOutput453
    3C-String-to-NumberConversionsandRobustInput455
    8.2THESTANDARDstringCLASS461
    IntroductiontotheStandardClassstring461
    1I/OwiththeClassstring464
    4ProgrammingTip:MoreVersionsofgetline467
    7Pitfall:Mixingcin>>variable;andgetline468
    8StringProcessingwiththeClassstring469
    9ProgrammingExample:PalindromeTesting473
    3ConvertingBetweenstringObjectsandCStrings476
    8.3VECTORS477
    VectorBasics477Pitfall:UsingSquareBracketsBeyondtheVectorSize480ProgrammingTip:VectorAssignmentIsWellBehaved481EfficiencyIssues481
    ChapterSummary483
    3AnswerstoSelf-TestExercises484
    4ProgrammingProjects486
    Chapter9PointersandDynamicArrays493
    9.1POINTERS494
    PointerVariables495
    5BasicMemoryManagement502
    2Pitfall:DanglingPointers503
    3StaticVariablesandAutomaticVariables504
    4ProgrammingTip:DefinePointerTypes504
    9.2DYNAMICARRAYS507
    ArrayVariablesandPointerVariables507
    7CreatingandUsingDynamicArrays508
    8PointerArithmetic(Optional)514
    4MultidimensionalDynamicArrays(Optional)516
    ChapterSummary518
    8AnswerstoSelf-TestExercises518
    8ProgrammingProjects519
    Chapter100DefiningClasses525
    10.1STRuCTuRES526
    StructuresforDiverseData526
    Pitfall:ForgettingaSemicoloninaStructureDefinition531
    StructuresasFunctionArguments532
    ProgrammingTip:UseHierarchicalStructures533
    InitializingStructures535
    10.2CLASSES538
    DefiningClassesandMemberFunctions538PublicandPrivateMembers543ProgrammingTip:MakeAllMemberVariablesPrivate551ProgrammingTip:DefineAccessorandMutatorFunctions551ProgrammingTip:UsetheAssignmentOperatorwithObjects553ProgrammingExample:BankAccountClass—Version1554SummaryofSomePropertiesofClasses558ConstructorsforInitialization560ProgrammingTip:AlwaysIncludeaDefaultConstructor568Pitfall:ConstructorswithNoArguments569
    10.3ABSTRACTDATATYPES571
    ClassestoProduceAbstractDataTypes572ProgrammingExample:AlternativeImplementationofaClass576
    10.4INTRODuCTIONTOINHERITANCE581
    DerivedClasses582DefiningDerivedClasses583
    ChapterSummary587AnswerstoSelf-TestExercises588ProgrammingProjects594
    Chapter111Friends,OverloadedOperators,andArraysinClasses601
    11.1FRIENDFuNCTIONS602
    ProgrammingExample:AnEqualityFunction602FriendFunctions606ProgrammingTip:DefineBothAccessorFunctionsandFriendFunctions6082/2/115:45PM
    contentsxxv
    ProgrammingTip:UseBothMemberandNonmemberFunctions610ProgrammingExample:MoneyClass(Version1)610Implementationofdigit_to_int(Optional)617Pitfall:LeadingZerosinNumberConstants618TheconstParameterModifier620Pitfall:InconsistentUseofconst621
    11.2OVERLOADINgOPERATORS625
    OverloadingOperators626
    6ConstructorsforAutomaticTypeConversion629
    9OverloadingUnaryOperators631
    1Overloading>>and
查看详情
相关图书 / 更多
C++程序设计(第8版 影印版)
C++之旅(第3版)(英文版)
(美)本贾尼·斯特劳斯特鲁普
C++程序设计(第8版 影印版)
C++趣味编程及算法入门 全国青少年软件编程等级考试与信息学竞赛通关指南(附600道习题+700个教学视频)
王桂平 等 编著
C++程序设计(第8版 影印版)
C++那些事
程克非,张兴,崔晓通,秦蔚蓉
C++程序设计(第8版 影印版)
C++编程这样学
胡芳
C++程序设计(第8版 影印版)
C++程序设计案例教程(线上线下混合版)
杨卫明;李晓虹
C++程序设计(第8版 影印版)
C++之旅(第3版)
[美]Bjarne Stroustrup(本贾尼 斯特劳斯特鲁普
C++程序设计(第8版 影印版)
C++面向对象程序设计(第4版)
谭浩强
C++程序设计(第8版 影印版)
C++高性能编程
(瑞典)比约恩 安德里斯特(Bj.rn Andrist),(瑞典)维克托 塞尔(Viktor Sehr)
C++程序设计(第8版 影印版)
C++开发案例精讲
杨国兴 著
C++程序设计(第8版 影印版)
C++ Concurrency in Action
Anthony Williams
C++程序设计(第8版 影印版)
C++语言设计教程(计算机专业十四五精品教材)
苏菲、王芬、朱腾 编
C++程序设计(第8版 影印版)
C++程序设计基础教程
丁卫平 程学云 陈文兰 主编;任红建 沈晓红 文万志 副主编
您可能感兴趣 / 更多
C++程序设计(第8版 影印版)
归属感:如何通过社群获得商业竞争优势
[美]大卫·斯平克斯(David Spinks) 著;颉腾文化 出品
C++程序设计(第8版 影印版)
《世界上最大的肚子》2024百班千人暑期书目学前中班名师推荐全新正版现货速发
[美]雷米·查利普(美)柏顿·萨普瑞
C++程序设计(第8版 影印版)
经济学通义
[美]阿门·A.阿尔钦 (美)威廉·R.艾伦 著;[美]杰里·L.乔丹 编
C++程序设计(第8版 影印版)
数字化领导力 数字化转型锦囊,领导力精进指南 一本书掌握数字化转型领导力之道
[美]艾萨克·萨科里克 著;王磊 译;颉腾文化 出品;邓斌
C++程序设计(第8版 影印版)
法哲学基本原理
[美]马克·C.墨菲
C++程序设计(第8版 影印版)
雪花的故事(用照片展示雪花的秘密,为你揭开冬日奇景的奥秘)
[美]马克·卡西诺[美]乔恩·尼尔森
C++程序设计(第8版 影印版)
杜甫传
[美]弗洛伦斯.艾思柯
C++程序设计(第8版 影印版)
神奇的数字零:从数字0开始的极简数学史和人类发展史
[美]查尔斯·塞弗(Charles Seife)著 杨杨立汝 译
C++程序设计(第8版 影印版)
美利坚在燃烧:20世纪60年代以来的警察暴力与黑人反抗
[美]伊丽莎白·欣顿 著 胡位钧 译
C++程序设计(第8版 影印版)
温柔亲启
[美]艾米莉·狄金森 著;[美]艾伦·路易斯·哈特、[美]玛莎·内尔·史密斯 编
C++程序设计(第8版 影印版)
儒教中国及其现代命运(三部曲)
[美]列文森 作者;[中]季剑青 译者
C++程序设计(第8版 影印版)
逃家小兔成长绘本系列
[美]玛格丽特.怀兹.布朗