-程序的选择结构(- program selection structure).doc_第1页
-程序的选择结构(- program selection structure).doc_第2页
-程序的选择结构(- program selection structure).doc_第3页
-程序的选择结构(- program selection structure).doc_第4页
-程序的选择结构(- program selection structure).doc_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、2-3程序的选择结构(2-3 program selection structure)2-3 program selection structureI. teaching objectives1, knowledge and skillsUnderstand the program selection structure of the conditions, select the execution process of the statement, master the choice of conditional choice of methods, can write a simple s

2、election of procedures, in order to solve some of the problems in life.2, methods and processThis section starts with a simple question, and by asking the absolute value of a number, let the students understand the flow of execution and how to use the conditional choice statement. And then do simila

3、r exercises, to strengthen students understanding, curriculum arrangements to form a gradual gradient, and fully tap the potential of students.3, emotions, attitudes and valuesThe choice of programming topics are encountered in life examples, to strengthen students use of this discipline to solve th

4、e problems of daily life.Two, key and difficult points1, teaching focus(1) the use of conditional choice statements(2) procedure condition selection structure execution flow(3) use conditional statements to write programs to solve simple application problems2, teaching difficultiesWrite the correct

5、procedure according to the titleThree, teaching environment1, teaching materials processingMaterials selected from the ordinary high school information technology in Guangdong Province, an algorithm and program design: the second chapter third section, calculating the original textbook first program

6、 example of rectangular, involving two yuan for a solution of equations, the use of the expressions is also more complex, too much may spend time in the course of teaching. So, in class, the example of the teaching material is simply processed, in order to make the absolute value of one number as th

7、e lead-in, and the students are more likely to understand the execution of the conditional statement. As for the variety of the select statement, a textbook selection for the Engel coefficient, thus judging the living level of the subject, before the new lesson is easy to explain, and then another s

8、tudent scores according to the judgment of the result is what levels are subject to as practice, students learn more, improve learning interest.2 prepare knowledgeStudents have mastered the concepts and descriptions of algorithms, defined the methods of constants and variables, the four steps of pro

9、gram design - Analysis of problems, modeling, design algorithms and programming.3, hardware requirementsIt is recommended that this class be completed in a multimedia computer classroom with a broadcast instruction system or an overhead projector.4, the required softwareStudent confidential installa

10、tion VB6.0 or above.5. Required class hour1 hours (45 minutes)Four, teaching processCreating situation:In CCTVs variety show lucky 52, I believe we have all seen, and one of them is see the goods, guess the price of the game, below we also imitate to play this game.Activity: guessing price game.In t

11、he VB program, can enter the price of judgment and choice give different information (high and low) so as to guide the player got the correct physical. Then, how to realize the judgment and the choice in the program design, this is the content which we must study in this lesson - the choice structur

12、e of the procedure (conditional statement).New lesson teaching:Lets start with a simple example: how do you program the absolute value of a number without a function?(1) analysis of the problem: the number of inputs is x, and the absolute value is y:(2) design algorithm:Enter a number xIf x = 0Y=xot

13、herwiseY=-xOutput y(3) writing program:Program 2-4Private sub command1_click () defines the event process named command1_click ()Dim x As Single defines the absolute value of the number x for the single precision real typeX=Val (Text1.Ttext) enter the value of x If x=0 Then if A=0Y=x x y will be giv

14、enElseY=-x -x y will be givenEnd IfText2.Text=y output y valueEnd sub the process is over(4) debug and run programsDemo: user interface design, programming code and run the program.The analysis program summarizes the format of the conditional statement.(a) the basic format of the conditional stateme

15、nt is:Demo: rewrite the If statement in program 2-4 into another format and run.The difference between the two formats: whether to write in a line, whether to End, IfAmong them, the condition is a logical expression, and the statement group is a set of VB statements.(two) the execution of a conditio

16、nal execution statementThe execution of the conditional statement is that when the condition is established, the statement group 1 following the then is executed, otherwise the execution group 2 is executed, and the execution flow of the conditional statement is shown in the following figure.Sometim

17、es you can omit the else statement and group 2 in the basic format of conditional statements, then the implementation of conditional statements is when the conditions hold, execute the statement following the then group 1, otherwise the exit condition statement, the following statement is executed,

18、the flow chart is shown in the right picture.(three) relation expressionIn the program 2-4 program, the third line is a conditional statement, the expression conditions of x=0, commonly known as the relationship between the expression of expressions are connected with relational operators.Relational

19、 arithmetic notation:Operational symbol= =MeaningBe equal togreater thanGreater than or equal toless thanLess than equal toNot equal toWhen the relationship table was established when its value is true (Ture), when the expression is not established when its value is false (False); the relationship b

20、etween the value of the expression is not a numerical type, not the character, but a number of new types of logic. A logical type has only two possible values: false (False) and true (Ture).The value of the relational expression is defined as follows:(1) the comparison of numerical data is done acco

21、rding to the magnitude of the values. Values such as 136 are true.(2) compare to other types of data, then compare them according to their serial numbers. For example, D B, the value is true, and the value of 13 6 is false.Exercise: (group discussion complete, answer the questions on the forums and

22、communicate with other groups)Write the corresponding VB statements.(1) if the X is greater than or equal to y, the value of the output X-Y is output.(2) if a is greater than B, the A is assigned to x, otherwise B is assigned to X.(3) if the x+y is not equal to 20, the answer is wrong, or else the a

23、nswer is correct.After the student has submitted, the teacher carries on the suitable review, then lets the student complete the following practice.Practice: write a program that runs to determine whether a score is qualified on the input. The reference interface is as follows:In practice, if a scor

24、e of 7079 is required to show that the score is good (otherwise it is not good), how should the conditions be expressed at this time? Can it be written as 70=x80 demonstration?.(four) logical expressionMultiple expressions connected by logical operator formula called logical expression.Logical operator:Not (non) takes the opposite number of operands. That is, when the operand is false, the result is true; when the operand is true, the result is false.And (and) when the two operands are true, t

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论