c语言教程英文版讲义(一)
C语言外语课件教学讲义
21
Assignment #6
Use the arrays of structures to store five students’ information including id, name and score, input the information from the keyboard, output the information of the student with the maximum score, then sort these students by scores from low to high, finally, output information of these students.
➢Write a function create to store three people’s information into the singly linked list;
➢Write a function print to print these information to the standard output;
24
Assignment #7
Write a function void decrement(int* a) to decrease the value of the argument in the main function by 1.You should use pointer as parameter to the function decrement.
2
Programming Environment
第1章 C语言概述(双语)
C
C 语言的发展
1978年C语言普及以后,先后被移植到大、中、 小及微机上,风靡世界。
1978年Brian W.Kernighan和Dnnis M.Ritchie 合著了《The C Programming Language》一书, 成为后来广泛使用的C语言基础,成为标准C。 后来美国国家标准化协会ANSI重新制定了新 的标准,成为ANSI C。
a.当型循环结构:先判断循环条件是否满足,当条件满足,执行 一遍循环体,再判断循环条件,仍满足再执行一遍循环体……直 到不满足条件,则退出循环,执行循环体后的下一语句。若第一 次判断条件就不满足,则一次也不执行循环体。
循环条件 满足吗? 满足 循环体
不满足
循环条件满足吗?
循环体
(a) 流程图表示 图 1.6
“自顶向下,逐步细化。基本结构,组 合而成。清晰第一,效率第二。书写 规范,缩进格式。”
1.4 面向对象的程序设计方法
70年代后,软件开发的手段和方 法越来越不能适应开发大型系统软件 的要求,因而出现了“软件危机”, 由此产生了面向对象的程序设计语言。 1983年美国Bell实验室的B.Stroustrup 在C语言基础上,扩充引进了面向对 象的概念,推出了C++语言。它与C 语言完全兼容,是目前使用最为广泛 的一种面向对象的程序设计语言。
aver=average(a,b,c);
printf(”the average is % 4 . 1 f ”,aver); }
总 结
说明:本程序包含两个函数:主函数main和被调函数average;主 函数第四行scanf是C语言的标准输入函数;第五行中调用average 函数,a, b, c的值分别传递给函数中的形参a1,b1,c1,返回函数值, 再赋给变量aver;最后输出变量aver的值,该程序运行情况如下:
C语言英文版课件
Zhang Xiaohang
张晓航 zhxiaohang@
C Language Programming
2
Class
12B07 12B08 12B09 12B10
Theory (place & time)
教二楼326 13:30~15:20 Monday
– Electronic components – Human operator manipulated external wiring
• Electrical Numerical Integrator and Computer (ENIAC, 1946)
– 18,000 Vacuum tubes – Weighted 30 tons / 5000 additions or 360 multiplications
Textbook: A First Book of ANSI C Fourth Edition
Grade is determined by –Experiment 10%
–Middle exam 15%
–Course work 5% –Final exam 70%
Website: /CPF
• The collections of patterns consisting of 0s and 1s used to represent letters, single digits, and other single characters are called character codes(字符编码)
• Mark I (1944)
– Mechanical relay switches
• Electronic Delayed Storage Automatic Computer (EDSAC, 1949)
C# 英文教材01
Slides11 / 24
Object Oriented Programming Using C#
Object-Oriented Methodology - Example
我们首先需要有车
要有人设计车
类(class)
要有工程图纸 造出真正的汽车
对象(object) 对象(object)
Ver. 1.0
Chapter 1 Introduction to the Object-Oriented Approach
Slides16 / 24
Object Oriented Programming Using C#
Just a minute
Identify the possible states of the following objects: 1. A cell phone 2. A stereo Answer: 1. States of a cell phone:Off,Ring, Vibrate,and Call 2. States of a stereo:Play,Pause, Rewind and Forward
Ver. 1.0
Chapter 1 Introduction to the Object-Oriented Approach
Slides9 / 24
Object Oriented Programming Using C#
Object-Oriented Methodology
Object-orientation(面向对象) is a software development methodology that is based on modeling a real-world system. An object is the core concept involved in object orientation. You can think of an object oriented model as a collection of objects and their interrelationship.
C语言程序设计(双语)课件Chapter_1_Introduction_to_C
C Programming LanguageInstructor: Rao HongComputer Center,Nanchang UniversityE-mail:raohong111@Text BookThe Art and Science of C,Eric S.RobertsChina Machine PressReference Books1.C程序设计(第二版),谭浩强,清华大学出版社2.C程序设计题解与上机指导(第二版),谭浩强,清华大学出版社Background◆This course is adopted from a CS106A at Computer Science Department of Stanford University.◆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.CS106A at Stanford◆CS106A is one of the largest coursed at Stanford. Itsenrollment now is over 900 a year.◆Together with 106B ,this series teaches you the Cprogramming language, which is widely used inindustry.◆CS106 is explicitly designed to appeal to humanistsand social scientists as well as hardcore technology disciplines.◆The course requires no previous background inprogramming, but does require considerablededication and hard work.GradesThe ordinary score 20% includes the quiz and all the assignmentsThe Final Examination will be 80% of the total score.Timetable 南昌大学课程教学进度表(2004-2005学年第二学期适用)CourseCProgrammingLanguageTextBookThe Art andScience ofC本课程计划总课时68本学期教学时数68任课教师饶泓班级2003级自动化1-2班考试或考查时间、次Week19Week Date 计划教学内容课外作业(Assignment)备注Memo(Related Sections)Week 1 February 24 1.Introduction to C2. C program structure3.Simple input and outputP.55 No.4,5P9-16 Chapter1.4-1.9P21-30 Chapter 2.1–2.3Week 2 March 3 1.Values,variables,and types2.Arithmetic Expressions3.PrecedenceP.54 No.19, 22P.55 No.6, 7P.33~P.51 Chapter 2.4-2.5Week 3 March 10 1.Problem solving2.Programming idioms3.Loops: for and whileP.95 No.9, 14 p.41~p.61Chapter 3Week 4 March 17 1.More problem solving2.Conditional testing3.The if and switchstatementP.135 No.2,8 P.100~P.132Chapter4Week5 March 24 Review the control statements:1.Condition statement: ifand switch2.Iteration statement: whileand forP.136No.10,11 Exercise ClassWeek 6 March 31 1.Functions and proceduresing librariesP.170No.2, 4,6 P.138~P.150Chapter5.1-5.3Week 7 April 7 Writing your own functions P171No.,7,8,12P.150~P.186Chapter5.4-5.6Week8 April 14 1.Review the functions2.Random numberP.296 No.8Exercise Class andP265 Chapter 8.2Week9 April 21 Algorithms P.217No.2, 7,10 P186 Chapter 6.1 P193 Chapter 6.2Week10 April 28 Introduction to arrays P.418 No.5, 7,11 P375 –P425 Chapter 11Week11 May 5 1.Character data;2.Strings as abstract types;The string.h libraryP.335No.3, 8,11P.302~P.330 Chapter 9P.492 ~P.516 Chapter 14Week12 May 12 1.Sorting;2.Selection sort;3.Evaluating an algorithmP.449No7, 11,12 P.425~446 Chapter 12Lecture 1Chapter 1 Introduction to C Related Chapters Sections 1.4-1.9,Sections 2.1–2.3ObjectivesTo 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 threephases:input,computation,and output.To understand the role of variables in a program as placeholders for data values.1.AlgorithmA strategy for solving a problem,mustbeClearly and unambiguously definedEffective,in the sense that its steps areexecutable;Finite,in the sense that it terminates after abounded number of steps2.Programming Language and compilationProgramming Language Classified asLow Level• Machine Language(binary-based code; machine dependent)Programming LanguageClassified asHigh Level• Closer to natural languages.• Generally, machine independent• Usually, several machine instructions are combined into one high-level instruction.• Examples:FORTRAN COBOL BASIC JavaPascal Ada PL/I LispC GPSS C++MatlabPrograms 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) Interpretation Used with Matlab, Visual Basic,...Processing a High-level Language ProgramThe Compilation Process #include <stdio.h>main(){printf(“hello \n”);}110111100101111010001010110010101001010101010010011100011101111001011110100010101100101010010101011010001010110010101001010101compiler linkerExecutable fileObject File Other ObjectFiles/LibrariesSource FileCompilationStep 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 anobject 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.Turbo CStep 1:Create source fileStep 2:Run the Complier(or Ctrl+F9)Step 3:Check the Result Alt+F5Visual C++ Create a new project3.Programming errors and debugging Syntax errors:Errors that result frombreaking syntactic rules.Bug:Mistakes that result from the wrong logic of the program.Debugging:The process of finding and correcting such mistakes.Chapter 2 Learning 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<stdio.h>#include “genlib.h ”main(){printf(“Hello,world!.\n");}library inclusion main program program commentLibrary inclusions#include<stdio.h>ANSI 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.main program #include ... ...main() { .. /* function body */.}a “block ” in C isdefined by a setof curly braces.A program to add two numbers/* File: add2.c* ------------* This program reads in two numbers, adds them together,* and prints their sum. */#include <stdio.h>/*#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);}promptinput computatio n outputdeclare the variableInput phrasen1n225scanf(“%d”,&n1);scanf(“%d”,&n2);The computation phasetotal = n1 + n2;The result of the expression is stored in a variable using an assignment statement.The output phaseprintf("The total is %d.\n", total)formatcodeThe %d format code means that the output should be displayed as a decimal integerPerspectives 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.You can perceive a program in either reductionistic approach or in holistic approach.Assignment:◆Be Familiar with the Turbo C environment and themenu of C or Visual C++◆Programming Exercises:P.55 No4,5◆Review Questions:P. 17 NO.10,12,13。
C语言双语教学c双语[1reface]PPT课件
– C compilers and C programs run on all sorts of computers
– Unix happens to be written in C.
2020/11/23
E-mail:
12
32 keywords:defined and used by C
Characteristics
C语言特点
The simplest C program C程序格式和结构特点
How to run C program C程序上机步骤
2020/11/23
E-mail:
6
1.1 C’s background
程序设计是数据被加工的过程
High level lang
Assemble lag
2020/11/23
E-mail:
9
◆ Let’s trace the development
Algol60 (1960)
2020/11/23
CPL (1963) BCPL (1967)
B (1970)
C (1972)
E-mail:
where:
Bell lab aim:
UNIX OS designer:
Problem-oriented languages(Fortran, Pascal) C
Machine-oriented languages(BCPL,B,)
Assembly languages
Hardware
2020/11/23
E-mail:
8
◆ The origin of C language
5 Arrays and Pointers
标准c语言教程 英文版 pdf
标准c语言教程英文版pdf一、简介《标准C语言教程英文版PDF》是一本全面、深入的C语言教程,旨在帮助读者掌握C语言的基础知识、语法规则和编程技巧。
本教程采用英文版PDF格式呈现,方便读者随时随地学习和参考。
二、内容概述本教程涵盖了C语言的基本语法、数据类型、运算符、表达式、控制结构、函数、数组、指针、结构体、文件操作等核心内容。
通过本教程的学习,读者可以全面了解C语言的各个方面,并掌握在实际编程中应用C语言的能力。
三、章节介绍1.第一章:C语言概述介绍C语言的发展历史、特点和应用领域。
通过本章学习,读者可以了解C 语言的基本概念,为后续学习打下基础。
2.第二章:数据类型和变量讲解C语言的基本数据类型,包括整数、浮点数、字符等。
同时,介绍变量的声明和赋值方法。
3.第三章:运算符和表达式讲解C语言的常见运算符,包括算术运算符、比较运算符、位运算符等。
通过本章学习,读者可以掌握C语言的基本算术运算。
4.第四章:控制结构讲解C语言的三种基本控制结构:if-else语句、switch语句、循环结构(for、while等)。
通过本章学习,读者可以掌握C语言的控制流程。
5.第五章:函数和库函数讲解函数的定义和调用方法,以及标准库函数的用法。
通过本章学习,读者可以掌握C语言的函数编程技巧。
6.第六章:数组和字符串讲解数组和字符串的基本概念和用法。
通过本章学习,读者可以掌握在C语言中处理数组和字符串的方法。
7.第七章:指针和内存管理讲解指针的基本概念和用法,以及内存管理的相关知识。
通过本章学习,读者可以掌握在C语言中操作内存的方法。
8.第八章:结构体和联合讲解结构体和联合的基本概念和用法。
通过本章学习,读者可以掌握在C语言中创建自定义数据类型的方法。
9.第九章:文件操作讲解C语言的文件操作功能,包括文件打开、读写、关闭等操作。
通过本章学习,读者可以掌握在C语言中处理文件的方法。
四、学习资源本教程提供了丰富的在线学习资源,包括视频教程、示例代码、习题解答等。
the c programming language 英文版
the c programming language 英文版
(原创版)
目录
1.TCP 协议简介
2.TCP 协议的常用应用
3.TCP 协议的协议号
4.UDP 协议的协议号
5.ICMP 协议的协议号和端口号
正文
一、TCP 协议简介
TCP(Transmission Control Protocol,传输控制协议)是一种面向连接的、可靠的、基于字节流的传输层通信协议。
TCP 协议通过三次握手建立连接,并提供可靠的数据传输和错误恢复机制,确保数据能够完整、准确地传输到目的地。
二、TCP 协议的常用应用
TCP 协议在网络通信中具有广泛的应用,常见的应用包括:
1.文件传输:如 FTP(文件传输协议)
2.电子邮件:如 SMTP(简单邮件传输协议)
3.网页浏览:如 HTTP(超文本传输协议)
4.远程登录:如 Telnet
三、TCP 协议的协议号
TCP 协议的协议号为 6,即在网络协议栈中,TCP 协议位于传输层,协议号为 6。
四、UDP 协议的协议号
UDP(User Datagram Protocol,用户数据报协议)是一种无连接的、不可靠的、基于数据报的传输层通信协议。
UDP 协议的协议号为 17,即在网络协议栈中,UDP 协议位于传输层,协议号为 17。
五、ICMP 协议的协议号和端口号
ICMP(Internet Control Message Protocol,互联网控制消息协议)是一种用于网络诊断和错误报告的协议。
ICMP 协议的协议号为 1,端口号通常为 13。
--C语言程序设计课件PPT(英文)C program language 之1 Introduction
How does a C program work
1 The development of Computer Language
………………….
The third generation
…… High Level Language
The second generation
Assembly Language
What is C program Language
What is C?
1
C is a computer programming language which can be used to create lists of instructions for a computer to follow.
Programming Language is a tool that can be used to design software,which can solve the definite problem
Computer software
Chapter one
What is C program Language
3
The instructions( 指令) are made up of statements( 语句) used in a programming language,
Chapter one
What is C program Language
What should we learn
About program language
Chapter one
What is C program Language
•What is computer-system •What is software •What is program •What is languaing language
C语言双语教学课件 章节一
– – – –
calls functions registered in exit() flush output streams close all open streams return status value and control to host environment
•
– additional Байду номын сангаасocal and external functions and variables
Kun ZHANG (10/15/2014) CIE – Software Design Group (SDG) 4
A Simple C Program
• • • • • • Create example file: try.c Compile using gcc: gcc –o try try.c The standard C library libc is included automatically Execute program ./try Note, I always specify an absolute path Normal termination: void exit(int status);
The C programming language
Tutorial introduction
Kun ZHANG (CIE)
Introduction
• The C programming language was designed by Dennis Ritchie at Bell Laboratories in the early 1970s • Influenced by – ALGOL 60 (1960), – CPL (Cambridge, 1963), – BCPL (Martin Richard, 1967), – B (Ken Thompson, 1970) • Traditionally used for systems programming, though this may be changing in favor of C++ • Traditional C: – The C Programming Language, by Brian Kernighan and Dennis Ritchie, 2nd Edition, Prentice Hall – Referred to as K&R
C语言英文版课件.ppt
Shorthand Assignment Operators
Statement with simple
assignment operator a=a+1 a=a–1 a = a * (n+1) a = a / (n+1) a=a%b
Statement with
shorthand operator a += 1 a -= 1 a *= n+1 a /= n+1 a %= b
Example 3.1
The Program shows the use of integer arithmetic to convert a given number of days into months and days.
main()
{
Output
int months, days; EnБайду номын сангаасer days
Non_zero 0
Non_zero 0
Value of the Expression
op_1&&op_2 op_1||op_2
1
1
1
1
1
1
1
1
Examples:
1. if (age > 55 && salary < 1000) 2. if (number < 0 || number > 1000)
The use of shorthand assignment operators has three advantages:
1. What appears on the left-hand side need not be repeated and therefore it becomes easier to write.
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
2Some Informationo Lecturingn C/C++ Language n Artificial Intelligence n Specialized Englisho Phone numbers and emailn Office: A0816n Phone: 84706003-3816n Email: eecc2012@3Textbooko 书名:C 语言教程(英文版·第4版)o 原书名:A Book on C:Programming in Co 作者:(美)Al Kelley, Ira Pohl o 出版社:China Machine Pres s4Professor of Computer and Information Scienceso Ira Pohl is a Professor of ComputerScience at the University of California, Santa Cruz.o His current research is in object-orientedprogramming(OOP) and topics in software methodology. He has written widely on programming in C, C++,C# and Java.o His research interests include artificialintelligence (AI), the C#, C, C++ and Java programming languages, practical complexity problems, heuristic search methods, etc..5Reference Readingo 书名:C 语言的科学和艺术(英文版)o 原书名:The Art andScience of C:A Library Based Introduction to Computer Science o 作者:Eric S.Robertso 出版社:China Machine Pres s6Reference Readingo 书名:C 程序设计语言(第2版·新版)o 原书名:The C ProgrammingLanguageo 作者:(美)Brian W.Kernighan,Dennis M.Ritchieo 出版社: Prentice-HallInternational , Inc.7Course administrationo Class hours :72 Credits :4n Teaching hours :48 hours (3 credits)n Practice hours :24 hours (1 credits)o Grading system :100n Final exam: 60%n Homework and Quizz: 15%n Projects: 25%Course administrationo Class is 4hours of lecture a week, Monday andWednesday at 13:30pm and 8:00amo 4 hours of practice a week ,6 weeks from 6th~11th week o 8hours a week of outside-the-class.9Why do we learn C language?o Today is the era of java and .net.oC is the fundament of OS. The kernel of Unix, Linux and Windows are written by C. Windows API is the interface of C functions. Unix/Linux applications are developed by C.oIf you want to be the superior of programmer, you must learn C language.oC# derived from C/C++What skills will you acquire?o You’re going to be able to write.o You’re going to be able to read.o Understand abilities and limits.o Understand what you can and cannot do.11How to study C programming:Some proverbso Standardization of formatn Well begun, half done.n A year ’s plan starts spring.o Have patiencen A workman must first sharpen his tools if he is to dohis work well.n Right tool for the right job.o Debug routinen Everything has a hard beginning.n Practice makes perfect.To follow, without halt, one aim:there the secret of success.12How to study C programming:o 1. Read all assigned reading in the textbook.--Not just once.--one paragraph at a time.--close the book, summarize the paragraph you just read.--If you could not summarize it quickly and accurately,read it again .o 2. Read your lecture notes in the same way.Type in all the programs you saw in class and make sure you understand them.o 3. Read the documentation of strcpy , strcat , strcmp ,malloc , calloc , strlen , printf , sprint , sscanf etc. Know how to find the documentation of any C library function and what is meant by "the documentation".o 4. Read your homework and make sure you know how itworks. The exams will definitely include several questions about the homework programs.13What I expect from you as a student:o Show up for classo Show up for class on timeo Know what the topic is for that dayo Have already read the corresponding part of the textbook (see the lecture schedule)o After the class meets, go over the material again (textbook, and notes, if any)o Do your homework (and on time!)o Do your own homework by yourself . (You can discuss it orally but you must do your own writing.)o Arrange your schedule so that you have identifiable hours each week to spend on this course.oWork at a steady pace throughout the semester instead of in frantic bursts just before the final exam.14What will we learn?o Program o Functionsn Declarationso Constant o Variablen fundamental :int, char, float, double n structured: array, struct, union n pointern Statementso assignmento control: if, for, do, while,…o compound o null150 Starting from Zero2 Lexical Element,Operators, and C System 3The Fundamental Data Types 4Flow of Control 5Functions6Arrays, Pointers and Strings7Bitwise Operators and Enumeration Types 8The preprocessor 9Structures and Unions 10Structures and List Processing11Input/Output and the Operating System13 Moving from C to C++Contents 16o Some termsn Computer language n Programn Programming n Algorithmo Program ’s Constitutionn Some representation of fundamental data n Give instructions to computer(decription of recipe)C/C++ Language17o What is the program?n data structure+algorithm=program n data structure+algorithm+structured programming method+language tool= programo Three basic structuresn Sequential n conditional n IterationC/C++LanguageNikiklaus Wirth——Computer Scientist18o 0.1 C ’s background o 0.2 C ’s Characteristic o 0.3 ANSI C Standard o 0.4 From C to C++o 0.5 From C and C++ to Java0 Starting from Zero19The basic organization of a computer system0.1 C ’s background Arithmetic sectionStorage sectionControl section Input device Output deviceresultprogramdataCPU20Machine languagesAssembly languagesHigh-level languageProcedure -oriented Object-oriented0.1 C ’s backgroundThe development of programming languages211.In the mid-1970s,UNIX spread throughout BellLabs.2.By 1980,several C compilers were put forward onthe market.3.By now,there are many versions of C languages.0.1 C ’s background The origin of C language 22True dialogueArtificial intelligence “ dialogues”Command languages(as in OS)Problem-oriented languages(Fortran, Pascal)Machine-oriented languages(BCPL,B)Assembly languagesHardware0.1 C ’s backgroundThe place of the C languageþýüþýülow-levelHigh-levelconcrete abstractdetailedgeneralpastfuture C23Algol60 (1960,an international committee)CPL (1963,Cambridge & Univ.of London)BCPL (1967, Martin Richards)B (1970, Ken Thompson)C (1972, Dennis Ritchie)0.1 C ’s background The development of the C language240.2 C ’s characteristicp C is a small language Keyword p C is the native language of Unix p C is portable Pascal p C is terse Operator p C is modularp C is the basis for C++ and Java p C is efficient on most machinesp C is not without criticism0.3 ANSI C Standard 26p C often serves as the kernel for more advanced or morespecialized languages.p C++ is an object-oriented language,it is the extension of C.0.4 From C to C++27p Java was designed for work on the Internetp It allows the programmer to write secure and portableprograms that can be downloaded from the Internet and run on your local machine.p Java borrows ideas from both C and C++ and is designed to run in a machine-and system-independent manner.0.5 From C and C++ to Java 28o Operating system o Source file o Text editor o Compiler o Object codeProgramming and preparation29We must do: 1. Edit it (*.c)2. Compile it (*.obj)3. Run it (*.exe)It depends on the system we are using.Programming and preparation 30Programming and preparation31VC++6.0Programming and preparation32“File ”→“New ”33“Files ”→“C++ Source Files ”34“File ”→“Save ”35“Build ”→“Compile test1.c ”36“Build ”→“Build test1.exe ”37“Build ”→“Execute test1.exe ”3839sea1.c#include <stdio.h>int main (){printf(“from sea to shining C\n ”);return 0;}Examplesfrom sea to shining CLibrary function 40sea2.c#include <stdio.h>void main(){printf(“from sea to ”);printf( “shining C ”);printf(“\n ”);}Examplesfrom sea to shining C41sea3.c#include <stdio.h>void main(){printf(“from sea\n ”);printf( “to shining \nC\n ”);}Examplesfrom sea to shining C42******************* from sea ** to shining C *******************43sea4.co #include <stdio.h>o void main()o {o printf("\n\n\n\n\n\n\n\n\n\n");o printf(" ******************\n");o printf(“* from sea *\n");o printf(“* to shining C *\n");o printf(" ******************\n");o printf("\n\n\n\n\n\n\n\n\n\n");o}Examples 44n miles and yards, kilometers. n Convert yards to miles, divide by 1760.0n Convert miles to kilometers, conversion factor 1.609n miles=yards/1760.0;nkilometers=1.609*miles;ExamplesIn English units, a marathon is defined to be2638542.245/* marathon .c The distance of a marathon in kilometers.*/Examples#include <stdio.h>void main(){ int miles,yards;float kilometers;miles=26;yards=385;kilometers=1.609*(miles+yards/1760.0);printf(“\nA marathon is %f kilometers.\n\n”, kilometers);}A marathon is 42.185969 kilometers.46/*The distance of a marathon in kilometers.*/Examplesp Convert the distance of a marathon in miles and yards to kilometers p int ,floatp V ariables must be declared at the beginning of the program p Identifier consists of a sequence of letters,digits,andunderscores,but may not start with a digit.p Comment p Semicolonp Assignment statement p precedence47Homeworko Write an interactive program that converts pounds andounces to kilograms and e symbolic constants that are defined at the top of the file outside of main().o 2. For a three-figure integer, get its unit's place , ten ’splace and hundred's place figure.o pute the roots of quadratic equation :ax 2+bx+c=0o 4.Input the three edges of a triangle, compute its area.o 5. Compute the BODY MASS INDEX(BMI)t= weight (kg)/height (m x m)ïïïîïïïíì³<£<£<£<II 0Obese .30 I 9Obese .9252t9Overweigh .42329Normal .225.18ht 5Underweig .18t t t t t 48Thank you!49Keywords( standard C:32)auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef unsigned union void volatile while50Keywords(C++:32)bad_cast bad_typeid bool catch classconst_cast delete dynameic_cast except explicitfinally friend inline mutable namespace new operator private protected public reinterpret-cast static_cast template this throwtrue try type-info typeid typename using virtual<51Control statements(9)if( )~else~for( )~while( )~do~while( )continue break switch goto return<52C & PascalC Pascal{ } BEGIN….END if(e) s; IF(e) THEN sint i ; VAR i:INTEGERint a[10]; VAR a:ARRAY[1..10] OF INTEGER int f(); FUNCTION f():INTEGERint *p;VAR p:-INTEGER<53Operatorsarithemetic:+ -* / % ++ --relational:< <= == > >= !=logical:!&& ||bitwise:<< >> ~ | ^ &assignment:= += -= *= /= %= &= ^= |= <<= >>=conditional:?:comma:,pointer:* &Bit count:sizeof case:(type-name)member:. ->index:[]others:( ) -<54Data TypesData typestandardstructure d pointer voidtypedefnumericchar enumintegral realfloatdoubleshort long intarraystruct union <55portableif (x>0) then BEGIN A:=1;B:= 2END;#define THEN #define BEGIN {#define := =#define END ; ;}if (x>0) {A=1;B=2;}<。