英格兰萨里大学:《C语言》课程教学资源(讲义)Lecture 1 - Introduction

12/02/2014Introduction to ProgrammingandProgrammingComputerArchitectureRichard BowdenRichard BowdenR.Bowden@surrey.ac.ukR.Bowden@surrey.ac.ukRm37AB05Rm37AB05www.surrey.ac.uk/Personal/R.Bowdenwww.surrey.ac.uk/Persona/R.Bowden.Howmanypeoplehaveprogrammedbefore?.What languages?Howmanypeople have programmedCor.C++?.Can anyonenameanyotherprogrammingProgramminglanguages?WHY C?.Some people find programming naturalRichard BowdenR.Bowden@surrey.ac.ukLearning a language doesn't necessarily.Rm 37AB05makeyoua programmerwww.surrey.ac.uk/Personal/R.BowdenThe only way to learn is to do it.ABrief HistoryofCWhyprogrammeinC?.Late1960sBCPL designed by Martin Richards, Cambridge:Advantages- Cis a real worid language, widely available and popular·1970Based on BCPL, B was designed by Ken Thompson,with professionalAt&T Bell Labs, for systems programming Cis a small, efficient, powerul and flexible language1972Based on B, C was designed by Dennis Ritchie, AT&TChas been standardised, making itmore portable thanBell Labs, for writing the Unix operating systemsome other languagesC is close to the computer hardware revealing the-·1970s,80sUnix and C gained wide popularityunderlying architecture1989C standardised: ANSI standard X3.159-1989- Cprovides enough low level accesstobe suitable forembedded systems1990C adopted as an international standard: ISO 9899:1990.Cis a high level language allowing complex systems to-beconstructedwithminimumeffort:1990sMinor amendments made to the standardsI
12/02/2014 1 Programming Richard Bowden R.Bowden@surrey.ac.uk Rm 37AB05 www.surrey.ac.uk/Personal/R.Bowden Introduction to Programming and Computer Architecture Richard Bowden R.Bowden@surrey.ac.uk Rm 37AB05 www.surrey.ac.uk/Personal/R.Bowden Programming Richard Bowden R.Bowden@surrey.ac.uk Rm 37AB05 www.surrey.ac.uk/Personal/R.Bowden • How many people have programmed before? • What languages? • How many people have programmed C or C++? • Can anyone name any other programming languages? • WHY C? • Some people find programming natural • Learning a language doesn’t necessarily make you a programmer • The only way to learn is to do it A Brief History of C • Late 1960s BCPL designed by Martin Richards, Cambridge • 1970 Based on BCPL, B was designed by Ken Thompson, At&T Bell Labs, for systems programming • 1972 Based on B, C was designed by Dennis Ritchie, AT&T Bell Labs, for writing the Unix operating system • 1970s,80s Unix and C gained wide popularity • 1989 C standardised: ANSI standard X3.159-1989 • 1990 C adopted as an international standard: ISO 9899:1990 • 1990s Minor amendments made to the standards Why programme in C? • Advantages – C is a real world language, widely available and popular with professional – C is a small, efficient, powerful and flexible language – C has been standardised, making it more portable than some other languages – C is close to the computer hardware revealing the underlying architecture – C provides enough low level access to be suitable for embedded systems – C is a high level language allowing complex systems to be constructed with minimum effort

12/02/2014Why programme in C?Why programme in C?·AdvantagesDisadvantages- C's modular approach suits large,mutt-programmerprojects- Cis not really a language for novices;it was designed forprofessional usersC's use of libraries makes it adaptable to many differen There are many things that can go wrong if you're not carefulapplicationareas The Unix operating system was wrtten in C and supports C C lacks much of he automatic checking found in other highlevel languages- C gave birth to C++,widely used for applications programming Smalltyping errors can cause umwanted effectand more recently Java which was based upon C++Manyotherlanguagesborrow from C'ssyntax:e.q.Java,-Does not support modern concepts such as objectJavaScript,Perletcorientationand multi-threading"C provides enough ropeto hangCprogram-Intro.cyourself time and time again"/+Exanple: C progran to find area or a cirele*/"#includecatdio.h三derinePl3.14159main():z):((yz)y:-100rloatprintr("enter the circle's xadius:")scanf("sr",&r)PI*r*rne(wInsts.\n",a):* 158-10C program - obscure.cEnter the circle'sradius:Its area is 78.54 square units2
12/02/2014 2 Why programme in C? • Advantages – C’s modular approach suits large, multi-programmer projects – C’s use of libraries makes it adaptable to many different application areas – The Unix operating system was written in C and supports C – C gave birth to C++, widely used for applications programming and more recently Java which was based upon C++ – Many other languages borrow from C’s syntax: e.q. Java, JavaScript, Perl etc Why programme in C? • Disadvantages – C is not really a language for novices; it was designed for professional users – There are many things that can go wrong if you’re not careful – C lacks much of he automatic checking found in other high level languages – Small typing errors can cause unwanted effect – Does not support modern concepts such as object orientation and multi-threading “C provides enough rope to hang yourself time and time again” if (x>y) if (x>z) max=x; else max=z; else if (y>z) max=y; else max=z; max=max+1; if (max==100) max=0; max=(x>y)?((x>z)?x:z):((y>z)?y:z); ++max%=100; if (max==100) max=0; = ≠ if (max=100) max==0; C program - Intro.c /* Example: C program to find area of a circle */ #include #define PI 3.14159 main() { float r, a; printf(“Enter the circle’s radius: ”); scanf(“%f”,&r); a=PI*r*r; printf(“Its area is %3.2f square units.\n”,a); return; } Enter the circle’s radius: 5 Its area is 78.54 square units. C program - obscure.c #include #include #include #include double L ,o ,P ,_=dt,T,Z,D=1,d, s[999],E,h= 8,I, J,K,w[999],M,m,O ,n[999],j=33e-3,i= 1E3,r,t, u,v ,W,S= 74.5,l=221,X=7.26, a,B,A=32.2,c, F,H; int N,q, C, y,p,U; Window z; char f[52] ; GC k; main(){ Display*e= XOpenDisplay( 0); z=RootWindow(e,0); for (XSetForeground(e,k=XCreateGC (e,z,0,0),BlackPixel(e,0)) ; scanf("%lf%lf%lf",y +n,w+y, y+s)+1; y ++); XSelectInput(e,z= XCreateSimpleWindow(e,z,0,0,400,400, 0,0,WhitePixel(e,0) ),KeyPressMask); for(XMapWindow(e,z); ; T=sin(O)){ struct timeval G={ 0,dt*1e6} ; K= cos(j); N=1e4; M+= H*_; Z=D*K; F+=_*P; r=E*K; W=cos( O); m=K*W; H=K*T; O+=D*_*F/ K+d/K*E*_; B= sin(j); a=B*T*DE*W; XClearWindow(e,z); t=T*E+ D*B*W; j+=d*_*D-_*F*E; P=W*E*B-T*D; for (o+=(I=D*W+E *T*B,E*d/K *B+v+B/K*F*D)*_; p K)N=1e4; else{ q=W/K *4E2+2e2; C= 2E2+4e2/ K *D; N-1E4&& XDrawLine(e ,z,k,N ,U,q,C); N=q; U=C; } ++p; } L+=_* (X*t +P*M+m*l); T=X*X+ l*l+M *M; XDrawString(e,z,k ,20,380,f,17); D=v/l*15; i+=(B *l-M*r -X*Z)*_; for(; XPending(e); u *=CS!=N){ XEvent z; XNextEvent(e ,&z); ++*((N=XLookupKeysym (&z.xkey,0))-IT? N-LT? UP-N?& E:& J:& u: &h); -*( DN -N? N-DT ?N== RT?&u: & W:&h:&J ); } m=15*F/l; c+=(I=M/ l,l*H +I*M+a*X)*_; H =A*r+v*X-F*l+( E=.1+X*4.9/l,t =T*m/32-I*T/24 )/S; K=F*M+( h* 1e4/l-(T+ E*5*T*E)/3e2 )/S-X*d-B*A; a=2.63 /l*d; X+=( d*lT/S *(.19*E +a *.64+J/1e3 )-M* v +A* Z)*_; l += K *_; W=d; sprintf(f, "%5d %3d" "%7d",p =l /1.7,(C=9E3+ O*57.3)%0550,(int)i); d+=T*(.45-14/l* X-a*130-J* .14)*_/125e2+F*_*v; P=(T*(47 *I-m* 52+E*94 *Dt*.38+u*.21*E) /1e2+W* 179*v)/2312; select(p=0,0,0,0,&G); v-=( W*F-T*(.63*m-I*.086+m*E*19-D*25-.11*u )/107e2)*_; D=cos(o); E=sin(o); } }

12/02/2014CourseOverviewCourseOverview.Aims. To lean the basics of computer programming and problemsolvingTo lean the C programming language and how this relates tothe physical architecture of the computer22hrsCourseStructure·.Lecturesdnra: Tutorials· Laboratories: exercises and assignmentsAssessment- No exam- Laboratories Worh 40%Assignments x3weekseachworth20%Introduction1Binary RepresentationCourse2Resources国国Hardware and SoflwareSimple Data TypesOverviewStandard 10中有有有有国国国国公司Operators, Expressions and Statements.BooksMaking DecisionsLooping-Teach yourself C in21Days,4thEdition,byPeterArmaysAitken and Bradley L Jones, SAMSBasics of PointersCopiesavilableinthe library so youhae noexuse.Puinters continmedStrings Any introductory book on C have a search of the libraryBasics of Functionscatalogue..WebData Structureseview of Pointerswww.surrey.ac.uk/Personal/R.BowdenisionBooksAitken,P. Jones, B., Sams Teach Yourself C in 21 Days0672324482.SamsGookin, D. C For Dummies, 2nd Edition, 978-0-7645-7068-1.WileyMGrrMGrorWatt,Smp0201403854.AddisonWesleyLongmanJackson,K,C Programmingfor Electronic Engineers0333637801,Macmillan PressKernighan,B.W&Ritchie,D.M.,The C ProgrammingLanguage,2nd Ed.,0131103628, Prentice HaliKnight,A. J."Basics of MATLAB and beyond", 1999,08493203993
12/02/2014 3 Course Overview • Aims • To lean the basics of computer programming and problem solving • To lean the C programming language and how this relates to the physical architecture of the computer • Course Structure • Lectures • Tutorials • Laboratories: exercises and assignments • Assessment • No exam • Laboratories – Worth 40% • Assignments x 3 – 2 weeks each worth 20% Course Overview Week 1 2 3 4 5 6 7 8 E1 E2 E3 E4 9 10 11 12 Lectures 2x2hrs Labs 2x2hrs Tutorials Assignment Lecture Assignment Due x x x Marks 40% 20% 20% 20% Course Overview [1] Introduction [2] Binary Representation [3] Hardware and Software [4] Simple Data Types [5] Standard IO [6] Operators, Expressions and Statements [7] Making Decisions [8] Looping [9] Arrays [10] Basics of Pointers [11] Pointers continued [12] Strings [13] Basics of Functions [14] More functions [15] Files [16] Data Structures [17] Review of Pointers [18] Revision Resources • Books – Teach yourself C in 21 Days, 4th Edition, by Peter Aitken and Bradley L Jones, SAMS. Copies available in the library so you have no excuse. – Any introductory book on C have a search of the library catalogue. • Web – www.surrey.ac.uk/Personal/R.Bowden Books • Aitken, P. Jones, B., Sams Teach Yourself C in 21 Days, 0672324482, Sams. • Gookin, D. C For Dummies, 2nd Edition, 978-0-7645- 7068-1, Wiley. • McGregor, J., McGregor, R., Watt, A., Simple C, 0201403854, Addison Wesley Longman • Jackson, K., C Programming for Electronic Engineers, 0333637801, Macmillan Press • Kernighan, B.W & Ritchie, D.M., The C Programming Language, 2nd Ed., 0131103628, Prentice Hall • Knight, A. J. “Basics of MATLAB and beyond”, 1999, 0849320399
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《计算机程序设计基础》课程学习指南(C语言)给C语言初学者的学习建议.pdf
- 《计算机程序设计基础》课程学习指南(C语言)C语言初学者编程规范-2/2.pdf
- 《计算机程序设计基础》课程学习指南(C语言)C语言初学者编程规范-1/2.pdf
- 《计算机程序设计基础》课程学习指南(C语言)C语言常见问题详解.pdf
- 《计算机程序设计基础》课程学习指南(C语言)C语言常见英文单词.pdf
- 《计算机程序设计基础》课程学习指南(C语言)C语言常见错误中英文对照表.pdf
- 《计算机程序设计基础》课程教学大纲 C Programming Language(C语言).pdf
- 《计算机控制系统》课程教学资源(PPT课件)第7章 计算机控制系统设计与实现.ppt
- 《计算机控制系统》课程教学资源(PPT课件)第6章 分布式测控网络技术.ppt
- 《计算机控制系统》课程教学资源(PPT课件)第5章 计算机控制系统软件设计相关技术.ppt
- 《计算机控制系统》课程教学资源(PPT课件)第4章 先进控制技术.ppt
- 《计算机控制系统》课程教学资源(PPT课件)第3章 常规数字控制技术.ppt
- 《计算机控制系统》课程教学资源(PPT课件)第2章 计算机控制系统硬件设计相关技术.ppt
- 《计算机控制系统》课程教学资源(PPT课件)第1章 计算机控制系统概述.ppt
- 《计算机控制系统》课程教学资源(PPT课件)前言.ppt
- 《计算机控制系统》课程试题试卷(答案).doc
- 《计算机控制系统》课程试题试卷(题目).doc
- 《计算机控制系统》课程教学大纲.pdf
- 《数据结构》课程教学资源(PPT课件)第四章 数组、集合和矩阵.ppt
- 《数据结构》课程教学资源(PPT课件)第六章 树和二叉树(6.7 树与二叉树的转换 6.8 树的遍历).ppt
- 英格兰萨里大学:《C语言》课程教学资源(讲义)Lecture 2 - Binary Representation.pdf
- 英格兰萨里大学:《C语言》课程教学资源(讲义)Lecture 4 - Simple Data Types.pdf
- 英格兰萨里大学:《C语言》课程教学资源(讲义)Lecture 5 - Standard IO.pdf
- 英格兰萨里大学:《C语言》课程教学资源(讲义)Lecture 6 - Operators, Expressions and Statements.pdf
- 英格兰萨里大学:《C语言》课程教学资源(讲义)Lecture 7 - Making Decisions.pdf
- 英格兰萨里大学:《C语言》课程教学资源(讲义)Lecture 8 - Looping.pdf
- 英格兰萨里大学:《C语言》课程教学资源(讲义)Lecture 3 - Hardware and Software.pdf
- 英格兰萨里大学:《C语言》课程教学资源(讲义)Lecture 9 - Arrays.pdf
- 英格兰萨里大学:《C语言》课程教学资源(讲义)Lecture 10 - Basics of Pointers.pdf
- 英格兰萨里大学:《C语言》课程教学资源(讲义)Lecture 11 - Strings.pdf
- 英格兰萨里大学:《C语言》课程教学资源(讲义)Lecture 12 - Basics of Functions.pdf
- 英格兰萨里大学:《C语言》课程教学资源(讲义)Lecture 13 - More functions.pdf
- 英格兰萨里大学:《C语言》课程教学资源(讲义)Lecture 14 - Files.pdf
- 英格兰萨里大学:《C语言》课程教学资源(讲义)Lecture 15 - Data Structures.pdf
- 《计算机程序设计基础》课程授课教案(C语言)第1章 C语言概述.pdf
- 《计算机程序设计基础》课程授课教案(C语言)第2章 基本数据类型和运算符.pdf
- 《计算机程序设计基础》课程授课教案(C语言)第3章 控制结构.pdf
- 《计算机程序设计基础》课程授课教案(C语言)第4章 数组和指针.pdf
- 《计算机程序设计基础》课程授课教案(C语言)第5章 模块化编程.pdf
- 《计算机程序设计基础》课程授课教案(C语言)第6章 指针进阶与内存空间管理.pdf