《C++程序设计课件:Chapter1 Overview of Programming and Problem Solving》由会员分享,可在线阅读,更多相关《C++程序设计课件:Chapter1 Overview of Programming and Problem Solving(26页珍藏版)》请在金锄头文库上搜索。
1、7/30/2024C+程序设计 教师:1C+程序设计(1)7/30/2024C+程序设计 教师:2课程介绍nC+基础知识(类,模版)nMicrosoft Visual C+ 6.0nVC+6 guide.pdf nVC 6 IDE 介绍7/30/2024C+程序设计 教师:3An Examplen#include nint main()nncouthello,world!;nreturn 0;n7/30/2024C+程序设计 教师:4考核方式n期末闭卷考核占50% necnucpp平台考核,出勤等平时成绩占50% 7/30/2024C+程序设计 教师:5参考书目书名:书名:C+C+程序设计语言
2、程序设计语言 英文书名:英文书名:The C+ Programming LanguageThe C+ Programming Language作者:作者:Bjarne StroustrupBjarne Stroustrup7/30/2024C+程序设计 教师:6参考书目书名:书名:C+ C+ 编程思想(编程思想(2nd2nd)英文书名:英文书名:Thinking in C+(Second Edition)Thinking in C+(Second Edition)作者:作者:Bruce EckelBruce Eckel7/30/2024C+程序设计 教师:7参考书目书名:书名:C+ Prime
3、r 英文书名:英文书名:C+ Primer 作者:作者:Lippman7/30/2024C+程序设计 教师:8参考书目书名:书名:Effective C+ 英文书名:英文书名:Effective C+ 作者:作者:Scott Meyers译者:译者:侯捷侯捷7/30/2024C+程序设计 教师:9参考书目书名:书名:More Effective C+英文书名:英文书名:More Effective C+:35 New Ways to Improve Your Programs and Designs作者:作者:Scott Meyers译者:译者:侯捷侯捷7/30/2024C+程序设计 教师:1
4、0Chapter1OverviewofProgrammingandProblemSolvingn1.1 Overview of ProgrammingnComputer Program a sequence of instructions to be performed by a computer.nComputer Programming the process of planning a sequences of steps for a computer to follow.nThe computer allows us to do tasks more efficiently, quic
5、kly and accurately.7/30/2024C+程序设计 教师:11Programs life cycle1. Problem-Solving Phase (requirement analysis and specification; algorithm design)nAlgorithmA step-by-step procedure for solving a problem in a finite amount of time.2. Implementation Phase (coding; debugging; testing)3. Maintenance Phase (
6、using; correct; improving)nIterative procedure. nProgram commentsnDocumentation7/30/2024C+程序设计 教师:12Two Algorithm ExamplesBOOK P41.Start your car.2.Determine an employees weekly wages.7/30/2024C+程序设计 教师:13From Algorithm to Program7/30/2024C+程序设计 教师:14From Algorithm to ProgramnProgramming language:nA
7、 set of rules, symbols, and special words used to construct a computer program.nC+ is an example of Programming Language.nOthers: JAVA, C#, Pascal, BASICnTranslating an algorithm into a programming language is called coding the algorithm.nThe combination of coding and testing an algorithm is called
8、implementation.7/30/2024C+程序设计 教师:15Determine an employees weekly wages.nSource file : PAYROLL.CPPnExecution file : payroll.exenExample Under Folder Payroll7/30/2024C+程序设计 教师:16Program Executioninput dataprogramoutputdata7/30/2024C+程序设计 教师:17程序调试debugging的一些方法n可能的程序分支都思考一遍可能的程序分支都思考一遍n在主程序的关键点添加重要变量
9、输出语句或设置断点在主程序的关键点添加重要变量输出语句或设置断点n在函数的调用前后添加重要变量输出语句或设置断点在函数的调用前后添加重要变量输出语句或设置断点7/30/2024C+程序设计 教师:18软件测试testingn测试只能证明BUG的存在,永远不能证明BUG的不存在。n测试的主要方法n黑盒法n白盒法7/30/2024C+程序设计 教师:19Language CategorynMachine language binary formnLow-level language Assembly language nHigh-level language C+, PascalnNatural
10、language English, French, Germann7/30/2024C+程序设计 教师:20From Source Program to Object ProgramobjectsourceCompilerSource program: A program written in a high-level programming language.Compiler: A program that translates a high-level language into machine code.Object program: The machine language versi
11、on of a source program.BOOK P7 Figure 1-3A computer can do: P87/30/2024C+程序设计 教师:21C+ CompilersnMicrosoft Visual C+nBorland C+nLinux GNU C+nnISO/ANSI Standard C+7/30/2024C+程序设计 教师:22Four Basic control structuresnSequentiallynConditionallynRepetitivelynWith subprograms (Divide and Conquer)nBOOK P10 F
12、igure1-67/30/2024C+程序设计 教师:23Computer SystemnHardware(P11 Figure 1-7)nCPUnALU Perform arithmetic and logical operations.nControl unit controls the actions of the other components.nMemorynI/O devicenPeripheral devicenSoftwarenOperating SystemnA set of programs that manages all of the computers resour
13、ces.nApplication7/30/2024C+程序设计 教师:24Problem-SolvingTechniquesnAsk QuestionsnLook for Things That Are FamiliarnSolve by AnalogynMeans-Ends AnalysisnDivide and Conquer(Functional Decomposition-FD, Object-oriented Design-OOD)nThe Building-Block ApproachnMerging SolutionsnRewriting the problem in your own words7/30/2024C+程序设计 教师:25上机课作业预习nChapter 1n熟悉VC的开发环境n熟悉编译、运行C+程序的基本过程。n1.Example:n#include nusing namespace std;nint main()nnint a,b;na = 627;nb = 365;ncouta+b;nreturn 0;n7/30/2024C+程序设计 教师:26课后在线平台评测WWW.ECNUCPP.COM