文档详情

《电脑出算术题》参考课件.ppt

发布:2025-02-24约1.79千字共7页下载文档
文本预览下载声明

八年级下册第五课电脑出算术题目录CONTENTS1234复习Math对象条件判断语句总结1复习文本窗口(Textwindow)对象3小海龟(turtle)对象1图形窗口(Graphsicwindow)对象2对象2对象3对象1对象语句1语句语句2赋值语句:变量名=数值S=3语句1循环语句:FOR…ENDFOR语句22Math对象程序a=math.GetRandomNumber(100)b=math.GetRandomNumber(100)c=a+bTextWindow.Write(a+++b+=)d=textwindow.Read()Ifc=dThenTextWindow.WriteLine(正确,你好棒!)EndIfIfcdThenTextWindow.WriteLine(你算错了,加油哦!)EndIfTextWindow.WriteLine(正确答案是:+a+++b+=+c)随机从1~100内产生一个整数并赋值给a操作者输入数字后按回车键,数字保存到d中3条件判断语句程序a=math.GetRandomNumber(100)b=math.GetRandomNumber(100)c=a+bTextWindow.Write(a+++b+=)d=textwindow.Read()Ifc=dThenTextWindow.WriteLine(正确,你好棒!)EndIfIfcdThenTextWindow.WriteLine(你算错了,加油哦!)EndIfTextWindow.WriteLine(正确答案是:+a+++b+=+c)格式1:If条件Then语句组EndIf3条件判断语句程序简化a=math.GetRandomNumber(100)b=math.GetRandomNumber(100)c=a+bTextWindow.Write(a+++b+=)d=textwindow.Read()Ifc=dThenTextWindow.WriteLine(正确,你好棒!)ElseTextWindow.WriteLine(你算错了,加油哦!)EndIfTextWindow.WriteLine(正确答案是:+a+++b+=+c)格式2:If条件Then语句组1Else语句组2EndIf练习4P29练习1将原程序改为电脑出下列形式的算术题:(a*b)-(a+b)=提示:修改红色部分a=math.GetRandomNumber(100)b=math.GetRandomNumber(100)c=a+bTextWindow.Write(a+++b+=)d=textwindow.Read()Ifc=dThenTextWindow.WriteLine(正确,你好棒!)ElseTextWindow.WriteLine(你算错了,加油哦!)EndIfTextWindow.WriteLine(正确答案是:+a+++b+=+c)a=math.GetRandomNumber(100)b=math.GetRandomNumber(100)c=(a*b)-(a+b)TextWindow.Write((+a+*+b+)-(+a+++b+)=)d=textwindow.Read()Ifc=dThenTextWindow.WriteLine(正确,你好棒!)ElseTextWindow.WriteLine(你算错了,加油哦!)EndIfTextWindow.WriteLine(“正确答案是:(+a+*+b+)-(+a+++b+)=+c)

显示全部
相似文档