首页 THE_C_PROGRAMMING_LANGUAGE

THE_C_PROGRAMMING_LANGUAGE

举报
开通vip

THE_C_PROGRAMMING_LANGUAGEnullTHE C PROGRAMMING LANGUAGETHE C PROGRAMMING LANGUAGECHAPTER 1CHAPTER 1A Tutorial Introductionnull一、操作系统的设计语言O.S. –––操作系统,为用户使用计算机提供一个操作环境:系统命令、语言编程等。如:DOS. UNIX以前:O. S .软件用汇编指令编写。汇编语言:一种二进制指令代码的符号表示,既烦锁,又易出错,可读性差。改进:用C语言编写,既提高了程序的可读性,又可与硬件打交道。null二、发展过程 1...

THE_C_PROGRAMMING_LANGUAGE
nullTHE C PROGRAMMING LANGUAGETHE C PROGRAMMING LANGUAGECHAPTER 1CHAPTER 1A Tutorial Introductionnull一、操作系统的设计语言O.S. –––操作系统,为用户使用计算机提供一个操作环境:系统命令、语言编程等。如:DOS. UNIX以前:O. S .软件用汇编指令编写。汇编语言:一种二进制指令代码的符号 关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf 示,既烦锁,又易出错,可读性差。改进:用C语言编写,既提高了程序的可读性,又可与硬件打交道。null二、发展过程 1960年出现了Algol60语言,但该语言主要面向问题,与硬件较远,故英国剑桥大学推出了CPL(Combined Programming Language) 1967年,Matin Richards对CPL进行改进、简化、推出了BCPL (Basic Combined Programming Language) 1970年,美国贝尔实验室Ken Thomson 以BCPL为基础,再次简化推出了B语言,并写了第一个UNIX系统。null 美国贝尔实验室D.M. Ritchie 在B语言基础上设计出了C语言,并用其将UNIX系统全部改写并实现。 经进一步改进,至1977年出现了与具体机器无关的C编译文本,从而使C语言广泛应用,各种机器皆可使用。 1978年,美国Brain W.Kernighan与Dennis. M. Ritchie 联合出版一书《The C Programming Language》成为 ANSI C之基础。null 1983年,美国 标准 excel标准偏差excel标准偏差函数exl标准差函数国标检验抽样标准表免费下载红头文件格式标准下载 化协会(ANSI) 制定了ANSI C。 ANSI C 为基础: 不同机器有不同版本,尤其是函数均应参考相应的机器。1.1 Getting started1.1 Getting startedEg.1:How To print the words:”hello,world” in C Language. #include main() {printf(“hello,world\n”);} 1. #Include:tells the compiler to include information about the standard input/output library.this line appears at the beginning of many C source files.We can use #Include “stdio.h” also.null2.Every C program include a function named main(). 3.statements of main are enclosed in braces{}.This function main contains only one statement. 4.You must use “\n” symbol to include a newline charater in the printf argument #include main() {printf(“hello,”); printf(“world); printf(“\n”);} “\n” is a escape sequence 5.Individual statements are terminated by semicolons;. nullEg2: #include main() { int x, y, z; x=2; y=3; z=x+y; printf("x+y=%d\n",z); }程序格式 关键字及编译预处理命令用小写字母书写。 由语句组成。 以分号(;)作为语句的结束符, (不是分隔符)。 没有行的概念,可任意书写。 用大括号对{}表示程序的层次 范围,一个完整的程序模块要用一对{}包括。 不能在变量名、函数名、关键字中插入空格和空行。nullEg.3:uses the formula 0c=(5/9)(0F-32)to print the following table of Fahrenheit temperatures and their centigrade or Celsius equivalents: 0 -17 140 60 20 –6 160 71 40 4 180 82 60 15 200 93 80 26 240 115 100 37 260 126 120 48 280 139 300 148null#include /*print Fahrenheit - celsius table for fathr=0,20,….300*/ main() {int fahr,celsius; int lower,upper,step; lower=0;/*lower limit of temperature table*/ upper=300;/*upper limit*/ step=20;/*step size*/ fahr=lower; while(fahr<=upper) {celsius=5*(fahr-32)/9; printf(“%d\t%d\n”,fahr,celsius); fahr=fahr+step;}} null1./*…..*/ are comments,which in this case explains briefly what the program dose.Any characters between /* and */ are ignored by the compiler;they may be used freely to make a program easier to understand. 2.In C,all variables must be declared before they are used,usually at the beginning of the function any executable statement.A declaration announces the properties of variables;it consists of a type name and a list variables,such as Int a,b,c; Float k,p; Long step;null3.the program begins with the assignment statements Lower=0; Upper=300; Which set the variables to their initial values. 4.Each line of the table is computed the same way so we use a loop that repeat once per output line;this is the purpose of the while loop.null5.The body of a while can be one or more statements enclosed in braces,a single statement without braces as in while(i
本文档为【THE_C_PROGRAMMING_LANGUAGE】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_018299
暂无简介~
格式:ppt
大小:297KB
软件:PowerPoint
页数:0
分类:互联网
上传时间:2012-02-25
浏览量:9