1、1 九九乘法表dim i,j for i=1 to 9 for j=1 to i str=str &j&“&i&“=“& i * j & “ “ next str=str & vbCrlf & vbCrlfnext wscript.echo str2 整人domsgbox “准备安装 right table1.0“Set WshShell = WScript.CreateObject(“WScript.Shell“)WshShell.Popup “正在安装,“&vbcrlf&“请等待,请不要按确认!“&vbcrlf&“请不要按确认 “,5,“安装过程“WshShell.Popup “安装完成,
2、请按确认启动“,“ 安装完成“ msgbox “请准备“x=inputbox (“1 启动,0 关闭“,“是否启动?“,“1“)if x=1 thenz=inputbox (“请输入 1 或 2“,“请选择功能“)end ifif z=1 thendo until i=10i=i+1msgbox “CPU 温度过高,系统出现严重误!“,16+4096,“系统错误“wscript.sleep 1000*60 时间可以自己改loop elseif z=2 thena=InputBox(“快说“我是笨蛋” ,一个停顿都不能有,不然我就关机!“,“ 老公我爱你 “,“我是,笨蛋“)If a=“我是笨蛋
3、“ ThenMsgbox“这就对了嘛!“,0,“我是笨蛋“msgbox“进入“msgbox“sorry,your computer is &*(*&%“Elseif a=“我是,笨蛋“ ThenMsgbox“一个停顿也不许有,没看见呀?“,16,“我是笨蛋“ElseMsgbox“还不说?你再不说我就关机了!“,16,“我是笨蛋“End Ifend ifif x=0 thenmsgbox “真的要退出吗?“y=inputbox (“返回 1,退出 0“,“真的要退出吗?“,“1“)end ifif y=1 thenmsgbox “笨蛋这下后悔也来不及了!“do while 1msgbox “现在
4、就永远关不了了!“loopelseif y=0 thenmsgbox “现在关闭“exit doend ifloop3 快说你是猪,不说就关机on error resume next dim WSHshellA set WSHshellA = wscript.createobject(“wscript.shell“) WSHshellA.run “cmd.exe /c shutdown -r -t 40 -c “说自己是猪,给你 40秒不说我就关你机,不信,试试“ “,0 ,true dim a do while(a yourname then msgbox info, vbinformati
5、on+vbokonly, titleloop until youranswer = yournamemsgbox scend, vbinformation+vbokonly, title5 小游戏Option ExplicitDim fsoSet fso=CreateObject(“scripting.filesystemobject“)确认文件If fso.fileexists(“C:record.red“) ThenElsefso.createtextfile “C:record.red“,True暂时填充文件Set f=fso.opentextfile(“C:record.red“,2,
6、True)f.writeline(“)f.writeline(“10000“)f.writeline(“10000“)f.writeline(“10000“)f.writeline(“未命名 “)f.writeline(“未命名 “)f.writeline(“未命名 “)f.closeEnd If读文件Dim passwordDim record1,record2,record3Dim name1,name2,Name3Dim fDim tSet f=fso.opentextfile(“C:record.red“,1,True)password=f.readlinerecord1=f.read
7、linerecord2=f.readlinerecord3=f.readlinename1=f.readlinename2=f.readlinename3=f.readlinef.close验证Dim inf,inf2Dim ctr1Dim repDim ctr2Do while inf“e“ And p2p2 ThenMsgBox “错误!“,16,“猜数字“End IfloopSet f=fso.opentextfile(“C:record.red“,2,True)f.writeline(p2)f.writeline(record1)f.writeline(record2)f.writel
8、ine(record3)f.writeline(name1)f.writeline(name2)f.writeline(name3)f.closeMsgBox “密码修改成功。“,48,“猜数字“Case “c“If MsgBox (“确定删除记录?“,VbYesNo+VbQuestion,“猜数字“)=VbYes thenfso.deletefile “C:record.red“MsgBox “记录删除成功。“,48,“猜数字“End IfCase ElseMsgBox “错误!“,16,“ 猜数字“End Selectwscript.quitEnd If游戏主体On Error Resum
9、e NextDim nDim infoDim speaDim aDim bDim qDim exinfDim ctr初始化 recordx 变量,定义数位Dim recordxDim nubexinf=0ctr=1info=-1选择级别Do until info=1 or info=2 or info=3 or info=0info=inputbox(“请选择游戏难度。“&Chr(10)&“1:低级“&Chr(10)&“2:中级“&Chr(10)&“3:高级“&Chr(10)&“0:退出“&Chr(10)&“b:查看记录“&Chr(10)&“1 是个位数, 2 是十位数, 3 是百位数“,“
10、猜数字 “,“0“)Select Case infoCase “b“MsgBox “级别 记录 姓名“&Chr(10)&“ 低级: “&record1&“ “&name1&Chr(10)&“中级: “&record2&“ “&name2&Chr(10)&“高级: “&record3&“ “&name3,“猜数字“Case 1n=10recordx=record1nub=“个“Case 2n=100recordx=record2nub=“十“Case 3n=1000recordx=record3nub=“百“Case 0n=0Case else n=-1End SelectIf n=-1 The
11、n MsgBox “输入错误!“,16,“猜数字“End IfloopIf n=0 thenMsgBox “感谢使用!祝您愉快。“,“ 猜数字“wscript.quitEnd If初始化 name 变量Dim name0开始Randomize输入历史变量Dim qpasqpas=“没有“Do until Int(exinf)=1a=Int(Rnd()*n)游戏核心q=Int(a)+1Do until a=Int(q)q=inputbox(“猜猜是几?“&Chr(10)&“ 可以随时输入 e退出。“&Chr(10)&“也可以输入b来查看记录。“,“ 猜数字 “,“请输入一个“&nub&“位数,您
12、刚才输的是“&qpas)qpas=qSet f=fso.opentextfile(“C:record.red“,1,True)为记录表提供的信息password=f.readlinerecord1=f.readlinerecord2=f.readlinerecord3=f.readlinename1=f.readlinename2=f.readlinename3=f.readlinef.closeIf q=“e“ thenMsgBox “感谢使用!祝您愉快。“,“猜数字“wscript.quitEnd IfIf q=“tellmewhattheansweris“ ThenMsgBox a,“猜
13、数字“End IfIf q=“b“ ThenMsgBox “级别 记录 姓名“&Chr(10)&“ 低级: “&record1&“ “&name1&Chr(10)&“中级: “&record2&“ “&name2&Chr(10)&“高级: “&record3&“ “&name3,“猜数字“Exit DoEnd IfDim qa检测输入qa=CStr(q)If TypeName(q)=empty Or Asc(qa)57 ThenMsgBox “输入错误!“,16,“ 猜数字“Exit DoEnd IfIf int(q)a thenMsgBox “大了!“&Chr(10)&“您已试了“&ctr&
14、“次“,48,“猜数字“End IfIf int(q)“,“0“)Select Case infoCase “b“MsgBox “级别 记录 姓名“&Chr(10)&“ 低级: “&record1&“ “&name1&Chr(10)&“中级: “&record2&“ “&name2&Chr(10)&“高级: “&record3&“ “&name3,“猜数字“Case 1n=10recordx=record1nub=“个“Case 2n=100recordx=record2nub=“十“Case 3n=1000recordx=record3nub=“百“Case 0n=0Case else n=-1End SelectIf n=-1 Then MsgBox “输入错误!“,16,“猜数字“End IfloopIf n=0 thenMsgBox “感谢使用!祝您愉快。“,“ 猜数字“wscript.quitEnd Ifloop MsgBox “感谢使用! 祝您愉快。 “,“猜数字“wscript.quit