模拟考试小程序源码(题库类小程序源码)
本文目录一览:
vb考试的一些小程序代码?
001求2的n次幂,n的值通过键盘输入
Private Sub Command1_Click()
Dim i As Integer, j As Integer, begin As Integer
begin = 7
For i = 1 To 4
Print Tab(begin);
For j = 1 To 2 * i - 1
Print "1 ";
Next j
begin = begin - 2
Next i
End Sub
002.求公式:e=1/1!+1/2!+1/3!+……+1/n! 直到最后一项小于10^(-6)时e的值。
(注:程序代码写在命令按钮Command1的Click事件中。)
Private Sub Command1_Click()
Dim e As Double, nj As Double
Dim n As Long, i As Long
e = 0
n = 1
Do
nj = 1
For i = 1 To n
nj = nj * i
Next i
e = e + 1 / nj
n = n + 1
Loop Until (1 / nj) 0.000001
Print e
End Sub
003编写程序计算并输出下面级数前n项(n=10)的部分和 用循环
1!+2!+3!+4!+....+n!
Private Sub Form_Click()
Dim sum As Long, jc As Long
Dim i As Integer, n As Integer
sum = 0
For n = 1 To 10
jc = 1
For i = 1 To n
jc = jc * i
Next i
sum = sum + jc
Next n
Print sum
End Sub
004编写程序,计算并输出下面级数前n项(n=10)的部分和要求用循环做1!+2!+3!+....+N!
Private Sub Form_Click()
Dim sum As Long, jc As Long
Dim i As Integer, n As Integer
sum = 0
n = Val(InputBox(""))
For n = 1 To n
jc = 1
For i = 1 To n
jc = jc * i
Next i
sum = sum + jc
Next n
Print sum
End Sub
005 *
***
*****
*******
*****
***
*
Private Sub Form_Click()
Dim i As Integer, begin As Integer
begin = 5
For i = 1 To 5
Print Tab(begin);
For j = 1 To 2 * i - 1
Print "*";
Next j
begin = begin - 1
Next i
begin = 2
For i = 1 To 4
Print Tab(begin);
For j = 1 To 9 - 2 * i
Print "*";
Next j
begin = begin + 1
Next i
End Sub
006编写程序,单击窗体时在窗体上输出如下所示的图形。
*
**
***
****
*****
******
*******
******
*****
****
***
**
*
Private Sub Form_Click()
Dim begin As Integer, n As Integer, i As Long
begin = 9
For i = 1 To 5
Print Tab(begin);
For n = 1 To 2 * i - 1
Print "*";
Next n
begin = begin - 2
Next i
begin = 3
For i = 1 To 4
Print Tab(begin);
For n = 1 To 9 - 2 * i
Print "*";
Next n
begin = begin + 2
Next i
End Sub
007编写程序,输出下列三角形总行数通过键盘输入用循环做
111111111
1111111
11111
111
1
Private Sub Command1_Click()
i = Val(InputBox(""))
begin = 1
For i = i To 1 Step -1
Print Tab(begin);
For j = 1 To 2 * i - 1
Print "1 ";
Next j
begin = begin + 2
Next i
End Sub
008勾股定理中三个数关系a2+b2=c2编写程序,输出100以内满足上述关系的整数组合,
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer
Dim cnt
cnt = 0
For a = 1 To 99
For b = 1 To 99
For c = 1 To 99
If (a * a + b * b = c * c) Then
Print a; ""; b; ""; c; "";
cnt = cnt + 1
If cnt Mod 6 = 0 Then Print
End If
Next c
Next b
Next a
End Sub
009
编写程序 输出100 到1000 之间的所有质数,并给出100 -1000 之间质数的个数以及和
Private Sub Form_Click()
Dim i As Long, n As Long
Dim cnt As Long, sum As Long
Dim flag As Boolean
cnt = 0
sum = 0
For n = 100 To 1000
flag = True
For i = 2 To n - 1
If n Mod i = 0 Then
flag = False
Exit For
End If
Next i
If flag = True Then
cnt = cnt + 1
sum = sum + n
Print n,
If cnt Mod 10 = 0 Then Print
End If
Next n
Print cnt, sum
End Sub
0010输出下列三角形 总行数在窗体单击事件通过键盘输入用循环
1
333
55555
7777777
Private Sub Form_Click()
Dim i As Long, j As Long
Dim n As Long, begin As Long
n = Val(InputBox(""))
begin = 2 * n - 1
For i = 1 To n
Print Tab(begin);
For j = 1 To (2 * i - 1)
Print Trim(2 * i - 1); " ";
Next j
begin = begin - 2
Next i
End Sub
0011求1000 以内分别被3 5 7 除余数都为1的正整数的个数以及其和
Private Sub Command1_Click()
Dim n As Integer, sum As Double
Dim cnt As Integer
sum = 0
cnt = 0
For n = 1 To 1000
If (n Mod 3 = 1) And (n Mod 5 = 1) And (n Mod 7 = 1) Then
Print n
cnt = cnt + 1
sum = sum + n
End If
Next n
Print "共"; cnt; "个"
Print "和为"; sum
End Sub
0012给定年号与月份,判断该年是否闰年,并根据给出的月份来判断是什么季节。
(闰年的条件是:年号能被4整除但不能被100整除,或者能被400整除)
Private Sub Command1_Click()
Dim year As Long
Dim month As Integer
year = Int(Val(InputBox("请输入年份")))
month = Int(Val(InputBox("请输入月份")))
If (year Mod 4 = 0 And year Mod 100 0) Or (year Mod 400 = 0) Then
Print year; "年是闰年,";
Else
Print year; "不是闰年,";
End If
Select Case month
Case 1, 2, 3
Print month; "月是春季"
Case 4, 5, 6
Print month; "月是夏季"
Case 7, 8, 9
Print month; "月是秋季"
Case 10, 11, 12
Print month; "月是冬季"
End Select
End Sub
0013输出用循环
G
FG
EFG
DEFG
CDEFG
BCDEFG
ABCDEFG
Private Sub Command1_Click()
Dim code1 As Integer, code2 As Integer
For code1 = Asc("G") To Asc("A") Step -1
For code2 = code1 To Asc("G")
Print Chr(code2);
Next code2
Next code1
End Sub
00141/(1*2)+1/(2*3)+1/(3*4)+.....+1/(n*(n+1)...
Private Sub Command1_Click()
Dim sum As Double, n As Long
sum = 0
For n = 1 To 30
sum = sum + 1 / (n * (n + 1))
Next n
Print sum
End Sub
0015 2
333
55555
8888888
1313131313131313131
Private Sub Command1_Click()
Dim n1 As Long, n2 As Long, n3 As Long
Dim cnt As Long, begin As Long
Dim i As Long, j As Long
cnt = Int(Val(InputBox("")))
begin = 4 * (2 * cnt - 1) / 2
n1 = 1
n2 = 1
For i = 1 To cnt
Print Tab(begin);
n3 = n1 + n2
For j = 1 To 2 * i - 1
Print Trim(n3); Spc(4 - Len(Trim(n3)));
Next j
begin = begin - 4
n1 = n2
n2 = n3
Next i
End Sub
0016奇数位减偶数位差
Private Sub Command1_Click()
Dim sum1 As Double, sum2 As Double
Dim str As String, i As Long
str = InputBox("")
Print str
sum1 = 0
sum2 = 0
For i = 1 To Len(str)
If i Mod 2 = 1 Then
sum1 = sum1 * 10 + Val(Mid(str, i, 1))
Else
sum2 = sum2 * 10 + Val(Mid(str, i, 1))
End If
Next i
Print sum1; "-"; Sum; ""; sum1 - sum2
End Sub
017序列:1,1/2,2/3,3/5,5/8,8/13,13/21......求这个数列的前20项之和
Private Sub Command1_Click()
Dim sum As Double
Dim a1 As Long, a2 As Long, a3 As Long
Dim b1 As Long, b2 As Long, b3 As Long
Dim i As Long
a1 = 1: a2 = 1
b1 = 1: b2 = 2
sum = a1 / b1 + a2 / b2
For i = 2 To 20
a3 = a1 + a2
b3 = b1 + b2
sum = sum + a3 / b3
a1 = a2
a2 = a3
b1 = b2
b2 = b3
Next i
Print sum
End Sub
0018 1
333
55555
7777777
999999999
Private Sub Command1_Click()
Dim i As Integer, j As Integer
For i = 1 To 5
Print Tab(20 - 3 * i);
For j = 1 To i * 2 - 1
Print i * 2 - 1;
Next j
Next i
End Sub
0019字符倒置
Private Sub Command1_Click()
Dim str1 As String, str2 As String
Dim i As Integer, k As Integer
str1 = InputBox("")
str2 = ""
k = Len(str1)
For i = k To 1 Step -1
str2 = str2 + Mid(str1, i, 1)
Next i
Print str2
End Sub
0020求e值 e=1+1/1!+1/2!.....
Private Sub Command1_Click()
Dim i As Integer, j As Integer
Dim s As Single, h As Single, l As Single, k!
k = 1
s = 1
For i = 1 To 20
k = k * i
s = s + 1 / k
Next i
Print s
End Sub
怎样制作考试的微信小程序
由于微信本身不具备在线考试的功能,所以组织考试需要先选择一款在线考试系统。注册并登录到在线考试系统的管理后台,可以查看到有非常多的组织考试相关的功能。
首先点击“我的题库”创建一个题库,并将考试所需要的具体题目编辑或导入到题库中备用。录入题目有很多种方式,word或excel导入、批量复制等操作都十分方便。
然后点击“我的试卷”来创建试卷。试卷分为公开和非公开两种,非公开试卷指的是内部考试试卷,考生需要使用账号密码进行登录,此类试卷还需要额外创建考生信息。我们这里选择创建所有人都能够参加的公开固定试卷。
将试卷的基本信息填写完毕后就进入了组卷环节,点击左上角的“手动选题”或“随机抽题”,能够从之前创建的题库中手选或机选出一定量的题目添加到试卷中,接着完成考试环境配置和题目分值设定后,即可发布试卷。
试卷发布成功后,会生成各种类型的考试入口,主要有网页链接、二维码、小程序码三种,由于我们需要的是微信考试小程序,因此将小程序码保存下来作为实际需要使用的考试入口即可。
考生在参与考试时,使用微信扫一扫功能扫描考试入口小程序码,就能够自动弹出微信小程序开始答题考试。您可以来轻速云官网注册免费体验一下操作流程!
初学编程,如何设计模拟一个蚂蚁群体的小程序?求帮助
我有个建议,如果想提高编程能力和培养兴趣,可以找一些简单的例子,最好是从vb学起,因为VB简单易懂,当你完成几个小软件的时候心里就特别高兴,我给你帖一个题目吧,你用vb做出来,如果做不出我给你答案,随便给你出个C++的题目.
VB题目:
1.目的
培养学生综合利用VB语言进行程序设计的能力,主要是培养学生利用VB的标准控件和基本算法进行应用程序设计的技能。
2.基本要求
能够按照要求生成若干个随机数据并显示到列表框中。
要求实现比较互换法、选择法和冒泡法三种基本算法。
使用Option控件进行项目的选择。
实现排序数据的导出功能,要求用文件的写操作
3.创新要求
在基本要求达到后,必须进行创新设计,创新点可以自己选择,方向提示如下(也可以自己拟订):
★ 增加排序算法。
★ 增加原始数据由文件导入的功能
★ 自己创新
三、设计方法和基本原理
1.问题描述
程序界面较简单见题图,大家都应该较容易理解,还需要说一下吗?
2.问题的解决方案
①设计程序界面
因为用的全是基本控件,界面设计没有什么难度,照样子拼就可以了。
②编写代码
代码主要包括事件处理过程。
事件处理包括下面的主要事件:
Form_Load()
作一些初始化的工作。主要是使数据指针不可见。
Command1_Click() ‘输入数据
根据要求产生所需要的原始数据并显示到列表框中。
Command2_Click() ‘完成排序数据的保存功能。
Private Sub Option1_Click() ‘实现比较互换法排序,并将结果显示到列表框中
Private Sub Option2_Click() ‘实现选择法排序,并将结果显示到列表框中
Private Sub Option3_Click() ‘实现冒泡法排序,并将结果显示到列表框中
四、主要技术问题的描述
本题中的难点并不在于界面设计。核心问题在于根据选择的排序算法实现对原始数据的排序。具体排序算法的原理都在教材上。都是最基本的算法。
原始数据的生成中,有生成个数、小数个数和范围的要求,需要用到的函数主要有
Randomize 和rnd函数生成随机数;
Round(x,y)保留小数位数
数据的显示用list控件的additem方法,如 list1.additem a(i)
另外,在编写option的click()事件实现排序算法时,要判断是升序还是降序,需要使用option控件的value属性,如
If option1.value=true then
升序
Elseif option2.value=true then
降序
Else
原样输出
Endif
还有各个单选按钮之间要通过对应的click()事件和gotofocus()事件关联起来,总之,都是一些最基本的东西,但是要使功能完善,就要熟练运用这些方法或事件。
最后,是文件的写操作功能,这是教材第7章中的内容,使用顺序文件的写操作就可以。
CommonDialog1.ShowSave
name = CommonDialog1.FileName ‘打开保存窗口,并为文件起名
具体的写操作如下
For i% = 0 To List2.ListCount - 1
Print #fileno, List2.List(i)
Next i
C++题目:精确计算100的阶乘
这两个题目我都有源码,希望你认真去做,同时有这方面的技术资料可以Q我。
在线考试系统源代码
Asp.Net+Ef+MVC+Bootstrap 在线考试,试题维护,各种统计分析,试卷导出Word。支持PC端和手机端。 271853837@qq.om