1、1.2.2 条件语句,练 习,练 习,B,B,B,B,B,D,问题提出,问题提出,1.输入语句、输出语句和赋值语句的 一般格式分别是什么?,问题提出,1.输入语句、输出语句和赋值语句的 一般格式分别是什么?,输入语句:INPUT “提示内容”;变量,问题提出,1.输入语句、输出语句和赋值语句的 一般格式分别是什么?,输入语句:INPUT “提示内容”;变量,输出语句:PRINT “提示内容”;表达式,问题提出,1.输入语句、输出语句和赋值语句的 一般格式分别是什么?,输入语句:INPUT “提示内容”;变量,输出语句:PRINT “提示内容”;表达式,赋值语句:变量=表达式,条件语句,知识探究
2、(一):条件语句(1),知识探究(一):条件语句(1),知识探究(一):条件语句(1),知识探究(一):条件语句(1),INPUT x,INPUT x,IF x0 THEN,INPUT x,IF x0 THEN,x=-x,INPUT x,IF x0 THEN,x=-x,END IF,INPUT x,IF x0 THEN,x=-x,END IF,PRINT x,END,INPUT x,IF x0 THEN,x=-x,END IF,PRINT x,知识探究(二):条件语句(2),知识探究(二):条件语句(2),知识探究(二):条件语句(2),知识探究(二):条件语句(2),INPUT “x=”;x
3、,INPUT “x=”;x,IF x=0 THEN,INPUT “x=”;x,IF x=0 THEN,PRINT x,INPUT “x=”;x,IF x=0 THEN,PRINT x,ELSE,INPUT “x=”;x,IF x=0 THEN,PRINT x,ELSE,PRINT -x,INPUT “x=”;x,IF x=0 THEN,PRINT x,ELSE,PRINT -x,END IF,END,INPUT “x=”;x,IF x=0 THEN,PRINT x,ELSE,PRINT -x,END IF,理论迁移,理论迁移,IF d=0 THEN,IF d=0 THEN,p= -b/(2*a
4、),IF d=0 THEN,p= -b/(2*a),q=SQR(d)/(2*a),IF d=0 THEN,p= -b/(2*a),q=SQR(d)/(2*a),IF d=0 THEN,IF d=0 THEN,p= -b/(2*a),q=SQR(d)/(2*a),IF d=0 THEN,PRINT “x1=x2=”;p,IF d=0 THEN,p= -b/(2*a),q=SQR(d)/(2*a),IF d=0 THEN,PRINT “x1=x2=”;p,ELSE,IF d=0 THEN,p= -b/(2*a),q=SQR(d)/(2*a),IF d=0 THEN,PRINT “x1=x2=”;p
5、,ELSE,PRINT “x1,x2=”;p+q,p-q,IF d=0 THEN,p= -b/(2*a),q=SQR(d)/(2*a),IF d=0 THEN,PRINT “x1=x2=”;p,ELSE,PRINT “x1,x2=”;p+q,p-q,END IF,IF d=0 THEN,p= -b/(2*a),q=SQR(d)/(2*a),IF d=0 THEN,PRINT “x1=x2=”;p,ELSE,PRINT “x1,x2=”;p+q,p-q,ELSE,END IF,IF d=0 THEN,p= -b/(2*a),q=SQR(d)/(2*a),IF d=0 THEN,PRINT “x1
6、=x2=”;p,ELSE,PRINT “x1,x2=”;p+q,p-q,ELSE,PRINT “No real root.”,END IF,IF d=0 THEN,p= -b/(2*a),q=SQR(d)/(2*a),IF d=0 THEN,PRINT “x1=x2=”;p,ELSE,PRINT “x1,x2=”;p+q,p-q,END IF,ELSE,PRINT “No real root.”,END IF,END,IF d=0 THEN,p= -b/(2*a),q=SQR(d)/(2*a),IF d=0 THEN,PRINT “x1=x2=”;p,ELSE,PRINT “x1,x2=”;p
7、+q,p-q,END IF,ELSE,PRINT “No real root.”,END IF,算法分析:,算法分析:,算法分析:,算法分析:,算法分析:,算法分析:,INPUT a,b,c,INPUT a,b,c,IF ba THEN,INPUT a,b,c,IF ba THEN,t=a,INPUT a,b,c,IF ba THEN,t=a,a=b,INPUT a,b,c,IF ba THEN,t=a,a=b,b=t,INPUT a,b,c,IF ba THEN,t=a,a=b,b=t,END IF,INPUT a,b,c,IF ba THEN,t=a,a=b,b=t,END IF,IF c
8、a THEN,INPUT a,b,c,IF ba THEN,t=a,a=b,b=t,END IF,IF ca THEN,t=a,INPUT a,b,c,IF ba THEN,t=a,a=b,b=t,END IF,IF ca THEN,t=a,a=c,INPUT a,b,c,IF ba THEN,t=a,a=b,b=t,END IF,IF ca THEN,t=a,a=c,c=t,INPUT a,b,c,IF ba THEN,t=a,a=b,b=t,END IF,IF ca THEN,t=a,a=c,c=t,END IF,INPUT a,b,c,IF ba THEN,t=a,a=b,b=t,END
9、 IF,IF ca THEN,t=a,a=c,c=t,END IF,IF cb THEN,INPUT a,b,c,IF ba THEN,t=a,a=b,b=t,END IF,IF ca THEN,t=a,a=c,c=t,END IF,IF cb THEN,t=b,INPUT a,b,c,IF ba THEN,t=a,a=b,b=t,END IF,IF ca THEN,t=a,a=c,c=t,END IF,IF cb THEN,t=b,b=c,INPUT a,b,c,IF ba THEN,t=a,a=b,b=t,END IF,IF ca THEN,t=a,a=c,c=t,END IF,IF cb THEN,t=b,b=c,c=t,INPUT a,b,c,IF ba THEN,t=a,a=b,b=t,END IF,IF ca THEN,t=a,a=c,c=t,END IF,IF cb THEN,t=b,b=c,c=t,END IF,INPUT a,b,c,IF ba THEN,t=a,a=b,b=t,END IF,IF ca THEN,t=a,a=c,c=t,END IF,IF cb THEN,t=b,b=c,c=t,END IF,PRINT a,b,c,END,练 习,练 习,A,练 习,练 习,22,-22,练 习,练 习,D,小结作业,小结作业,小结作业,小结作业,