【VB开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。
网学会员整理了VB开源代码-VB程序设计第三版实验B答案 - 编程语言的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
VB程序设计第三版实验B答案全 1 Private Sub Command1_Click Text2 Format5 / 9 ValText1 - 32 0.00 End Sub Private Sub Command2_Click Text1 Format9 / 5 ValText2 32 0.00 End Sub 或 Private Sub Command1_Click Dim f c 声明两个变量 f ValText1 c 5 / 9 f - 32 Text2 Formatc 0.00 保留两位小数 End Sub Private Sub Command2_Click Dim ff cc 声明两个变量 cc ValText2 ff 9 / 5 cc 32 Text1 Formatff 0.00 保留两位小数 End Sub 2 Private Sub Command1_Click Label2 FormatValText1 ValText1 3.14 0.00 End Sub Private Sub Command2_Click Label3 FormatValText1 3.14 2 0.00 End Sub Private Sub Text1_LostFocus If Not IsNumericText1.Text Then MsgBox 输入有非数字字符请重新输入 警告 Text1.Text Text1.SetFocus End If End Sub 或 Private Sub Command1_Click Label2 FormatValText1 ValText1 3.14 0.00 End Sub Private Sub Command2_Click Label3 FormatValText1 3.14 2 0.00 End Sub Private Sub Text1_KeyPressKeyAscii As Integer If KeyAscii 13 Then If Not IsNumericText1.Text Then Text1.Text End If End If End Sub 3 Private Sub Command1_Click n IntLog2 / Log1.008 1 Label1 n 年后人数超过26亿 End Sub 4 Private Sub Command1_Click Dim x dx cd x Text1.Text dx UCasex cd Lenx Print 大写字母为: dx Print 字符串长度为: cd End Sub 5 Private Sub Command1_Click Text1 IntRnd 900 100 End Sub Private Sub Command2_Click Dim x x1 x2 x3 x ValText1 x1 x Mod 10 分离出的个位数 x2 x Mod 100 10 分离出的十位数 x3 x 100 分离出的百位数 Label1 x1 100 x2 10 x3 End Sub 6 Private Sub Form_Click Label1 LeftText1 11 Label2 MidText1 12 6 Label3 RightText1 5 End Sub 7 Private Sub Command1_Click Print For i 1 To 5 Print Tab15 - i 2 String2 i - 1 ★ Spc18 - 4 i - 1 String2 i - 1 ★ Next i End Sub Private Sub Command2_Click Cls End Sub 进一步要求 Private Sub Command1_Click Print For i 1 To 5 Print Tab15 - i 2 String2 i - 1 ★ String10 - 2 i - 1 ☆ String2 i - 1 ★ Next i End Sub Private Sub Command2_Click Cls End Sub 8 Private Sub Form_Click x ValInputBox输入一正实数 计算 0 pf Formatx x 0.000 pfg FormatSqrx 0.000 lf Formatx x x 0.000 lfg Formatx 1 / 3 0.000 Print 平方为: pf Space5 平方根为: pfg Space5 立方为: lf Space5 立方根为: lfg End Sub