欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    C语言程序设计(双语)课件Chapter 1 Introduction to C_.ppt

    • 资源ID:87679511       资源大小:212.50KB        全文页数:30页
    • 资源格式: PPT        下载积分:15金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要15金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    C语言程序设计(双语)课件Chapter 1 Introduction to C_.ppt

    C Programming LanguageInstructor:Rao HongComputer Center,Nanchang UniversityE-mail:Reference Books1.1.C C程序设计(第二版),谭浩强,清华大学程序设计(第二版),谭浩强,清华大学出版社出版社2.2.C C程序设计题解与上机指导(第二版),谭程序设计题解与上机指导(第二版),谭浩强,清华大学出版社浩强,清华大学出版社Text BookThe Art and Science of C,Eric S.Roberts China Machine PressRao Hong NCU-Autumn 2004The Art and Science of CBackgroundu This course is adopted from a CS106A at Computer Science Department of Stanford University.u Most of the materials(textbook,some handouts,software as well as most assignments)we will use in the class is adopted from CS106A of Stanford.Rao Hong NCU-Autumn 2004The Art and Science of CCS106A at StanfordCS106A is one of the largest coursed at Stanford.Its enrollment now is over 900 a year.Together with 106B,this series teaches you the C programming language,which is widely used in industry.CS106 is explicitly designed to appeal to humanists and social scientists as well as hardcore technology disciplines.The course requires no previous background in programming,but does require considerable dedication and hard work.Rao Hong NCU-Autumn 2004The Art and Science of CGradesThe ordinary score 20%includes the quiz and all the assignments The Final Examination will be 80%of the total score.Rao Hong NCU-Autumn 2004The Art and Science of CTimetableRao Hong NCU-Autumn 2004The Art and Science of CLecture 1Chapter 1 Introduction to CRelated Chapters Sections 1.4-1.9,Sections 2.12.3 ObjectivesTo understand the meaning of the term algorithmTo appreciate the role of the compiler as a translator between a higher-level programming language and the low-level machine languageTo recognize that many simple programs are composed of three phases:input,computation,and output.To understand the role of variables in a program as placeholders for data values.Rao Hong NCU-Autumn 2004The Art and Science of C1.AlgorithmA strategy for solving a problem,must be Clearly and unambiguously definedEffective,in the sense that its steps are executable;Finite,in the sense that it terminates after a bounded number of stepsRao Hong NCU-Autumn 2004The Art and Science of C2.Programming Language and compilation Programming Language Classified asLow Level Machine Language(binary-based code;machine dependent)Rao Hong NCU-Autumn 2004The Art and Science of CProgramming Language Classified asHigh Level Closer to natural languages.Generally,machine independent Usually,several machine instructions are combined into one high-level instruction.Examples:FORTRAN COBOLBASIC JavaPascal Ada PL/I LispC GPSSC+Matlab Rao Hong NCU-Autumn 2004The Art and Science of CPrograms written in high-level languages must be converted to machine language.Two approaches:(1)Compilation(see p.12 Figure1-2)Used with C,C+,Fortran,.(2)InterpretationUsed with Matlab,Visual Basic,.Processing a High-level Language ProgramRao Hong NCU-Autumn 2004The Art and Science of CThe Compilation Process#include main()printf(“hellon”);110111100101111010001010110010101001010101010010011100011101111001011110100010101100101010010101011010001010110010101001010101compilerlinkerExecutable fileObject FileOther Object Files/LibrariesSource FileRao Hong NCU-Autumn 2004The Art and Science of CStep 1)Use TC to create a“source”file.We will name source files with a suffix“.c”Step 2)Run the compiler on the source file to create an object file and executable file with the default name a.exe and a.obj.(Ctrl+F9)Step 3)Check to see if compilation caught any syntax errors,if so go back to step 1)Step 4)Check the result through Alt+F5 at the full screen.CompilationRao Hong NCU-Autumn 2004The Art and Science of CTurbo CStep 1:Create source fileRao Hong NCU-Autumn 2004The Art and Science of CStep 2:Run the Complier(or Ctrl+F9)Rao Hong NCU-Autumn 2004The Art and Science of CStep 3:Check the ResultAlt+F5Rao Hong NCU-Autumn 2004The Art and Science of CVisual C+Create a new projectRao Hong NCU-Autumn 2004The Art and Science of C3.Programming errors and debuggingSyntax errors:Errors that result from breaking syntactic rules.Bug:Mistakes that result from the wrong logic of the program.Debugging:The process of finding and correcting such mistakes.Rao Hong NCU-Autumn 2004The Art and Science of CChapter 2Learning by Example1.The“Hello world“program /*File:hello.c*-*This program prints the message“Hello,world.”*on the screen.The program is taken from the classic C*reference text“The C programming Language”by*Brian Kernighan and Dennis Ritchie.*/#include#include“genlib.h”main()printf(“Hello,world!.n);library inclusionmain programprogram commentRao Hong NCU-Autumn 2004The Art and Science of CLibrary inclusions#includeANSI C standard libraries are marked with angle brackets#include“genlib.h”Personal libraries are specified using quotation marks.There is no such library in the ANSI C.Rao Hong NCU-Autumn 2004The Art and Science of Cmain program#include.main()./*function body*/.a“block”in C is defined by a set of curly braces.Rao Hong NCU-Autumn 2004The Art and Science of CA program to add two numbers/*File:add2.c*-*This program reads in two numbers,adds them together,*and prints their sum.*/#include/*#include genlib.h*#include simpio.h“*/main()int n1,n2,total;printf(This program adds two numbers.n);printf(1st number?);scanf(“%d”,&n1);/*n1=GetInteger();*/printf(2nd number?);scanf(“%d”,&n2);/*n2=GetInteger();*/total=n1+n2;printf(The total is%d.n,total);promptinputcomputationoutputdeclare the variableRao Hong NCU-Autumn 2004The Art and Science of CInput phrase25n1n2scanf(“%d”,&n1);scanf(“%d”,&n2);Rao Hong NCU-Autumn 2004The Art and Science of CThe computation phasetotal=n1+n2;The result of the expression is stored in a variable using an assignment statement.Rao Hong NCU-Autumn 2004The Art and Science of CThe output phaseprintf(The total is%d.n,total)The%d format code means that the output should be displayed as a decimal integerformat codeRao Hong NCU-Autumn 2004The Art and Science of CPerspectives on the programming process Look at the main program for the add2.c program again and try to express in one sentence what it does:main()int n1,n2,total;printf(This program adds two numbers.n);printf(1st number?);scanf(“%d”,&n1);/*n1=GetInteger();*/printf(2nd number?);scanf(“%d”,&n2);/*n2=GetInteger();*/total=n1+n2;printf(The total is%d.n,total);The program adds two numbers and display the result.Rao Hong NCU-Autumn 2004The Art and Science of CYou can perceive a program in either reductionistic approach or in holistic approach.Rao Hong NCU-Autumn 2004The Art and Science of CAssignment:Be Familiar with the Turbo C environment and the menu of C or Visual C+Programming Exercises:P.55 No4,5Review Questions:P.17 NO.10,12,13Rao Hong NCU-Autumn 2004The Art and Science of C

    注意事项

    本文(C语言程序设计(双语)课件Chapter 1 Introduction to C_.ppt)为本站会员(asd****56)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开