1、1.2.2 条件语句,练 习,练 习,A,条件语句,知识探究(一):条件语句(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 x=0 THEN,INPUT “x=”;x,IF x=0 THEN,PRINT x,INPUT “x=”;x,IF x=0 THEN,PRINT x,ELSE,INPUT “x=”
2、;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),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=
3、-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,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
4、 “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=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
5、),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+q,p-q,END IF,ELSE,PRINT “No real root.”,END IF,算法分析:,算法分析:,算法分析:,算法分析:,算法分析:,算法分析:,INPUT a,b,c,INPUT a,b,c
6、,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 ca 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,I
7、F 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 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
8、=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,小结作业,小结作业,小结作业,小结作业,作业:习案6,