c语言英文课件chapter6,c语言程序设计课件ppt(英文)c program language 之1 introduction...

LOGOChapter OneIntroductionContentsWhat is C program language 1Characteristics of C langugae2How does a C program work3What a C program can do4C Program Sturcture5How to use Turbo C6Programming basics7Sumary8documentdataprogramComputersoftwareWhat is C program Language•What is computer-system•What is software•What is program•What is languageC is a general-purpose programming language Programming Language is a tool that can be used to design software,which can solve the definite problem1programming simply means telling a computer what to do.3lThe instructions(( 指令)指令) are made up of statements(( 语句语句)) used in a programming language, 2A program is a list of instructions for the computer to follow to accomplish the task of processing data into informationWhat is C program LanguageWhat’s programming Term:InstructionStatementProgramlanguageWhat is C program LanguageAbout program language What should we learnSyntax(( 语法)语法) Arithmetic(算法算法 ) Program design-the language rules,the meaning of the charactersProcedure to solve a problem How to solve the problem What is C?What is C program Language1C is a computer programming language which can be used to create lists of instructions for a computer to follow. 3C has been around for several decades and has won widespread acceptance because it gives programmers maximum control and efficiency. 2C is one of thousands of programming languages currently in use. C is an easy language to learn. main( ){ int a,b,sum;a=10;b=20;sum=a+b;printf(“%d “,sum);}Calcultionmain( ){ int i,s=0;for(i=1;imain( ){ int a,b,sum;a=10;b=20;sum=fun(a,b);printf(“%d,%d,%d\n”,a,b,sum);}fun(int x,int y){ return(x+y);}Variables( 变量)Constant( 常量)Expression( 表达式 )Function call( 函数调用)Preprocessor(预处理 )Statement( 语句 )Term:• variable• constant• function• expressionC Program StructureC Program StructureC programBGDFAVariablesConstants FunctionsOperatorsKeywordsCPreprocessor commandsESome useful charactersC Program Structurekey-factors in C Language:Lower case2 Most C programs are in lower case letters.C is case sensitive .MAIN FUNCTION1. Every C program contains a function called main. This is the start point of the program.The two brackets show the start { and finish } of the function.Function3 Function is the smallest unit in C program.C program consist of functions operating on data.C function consist of statements with a blockKey:main( ) { }C Program StructureFunctionDeclaration StatementExecutive StatementVariablesFunction prototypeVariables typeVariable nameBlank statementFunction call statementControl statementBlock structureExpression statementAbout Function函函数数说明说明语句语句执行执行语句语句变量变量类型类型变量名变量名存储存储类型类型操作操作类型类型表达式语句表达式语句控制语句(控制语句( 9种)种)函数调用语句函数调用语句复合语句复合语句空语句空语句表达式表达式运算符(运算符( 34种种 )常量常量变量变量表达式表达式函数调用函数调用分号分号基本类型基本类型构造类型构造类型指针指针运算运算分量分量整型整型实型实型字符型字符型 自动变量自动变量静态变量静态变量外部变量外部变量寄存器寄存器单精度单精度双精度双精度分号分号函数名(实参)函数名(实参)数组数组结构体结构体 …………C Program Structure4 . About statement( 语句 )C Program Structurekey-factors in C Language:Functioncallblank blockcontrolexpressionstatementEvery statement should be end by a “;”(1) Blank statement ;(2) Block { …} Block can also be called compound statement . Several statements are organized in {…} as one statement when it executes.if (a60){ printf(“you have passed the exam”);printf(“%d”,a );}else ; C Program Structureforwhiledo -whileif -elsereturncontrolswitchgotocontinuebreakControl the flow while running programC Program Structure(3) Control statementC Program Structure(4) Function call statementprintf(“you have passed the exam”);6. Operators in C program(5) Expression statementexpression ; a = b+c ;We learn about operators not only the role but also the precedence(优先级 ), that is the executive order of different operators occur at the same time.key-factors in C Language:C Program StructureArithmetic: + - * / % ++ --Relational: = !=Logical: ! }key-factors in C Language:ProgrammingProgram maintenanceProgramcodeProgram designProgram specificationProgramming basicssix-steps:Program documentationProgramtestSelf reviewExample:The sum of two numbersmain ( ){ int a =3, b= 5 ,c ; /* declaration of a,b,c */c= a+ b; /* operation---addition */printf( “%d, %d, % d”,a,b,c); /* operation ---output */}• How to exchange two values? • Which year is leap year from 2000 to 2500 ?• Which numbers can be devided by both 5 and 7 under 100?Programming basicsArithmetic (算法 )Programming basics1. Finite (有穷性 ) : limited steps2. Definite (确定性 ) : Each step should be correct 3. No or one Input (Entry)4. One or more output 5. Validity (有效性) :Each step should be availabilityThe features of Arithmetic (算法 )

展开阅读全文

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值