谁帮我做4条编程题?用VB6.0编哦!星期五上午之前要!

来源:百度知道 编辑:UC知道 时间:2024/05/23 14:45:39
1。随机生成15个100以内的正整数并显示在一个文本框中,再将所有对称位置的两个数据对调后显示在另一个文本框中(第1个数与第15个对调,第2个与第14个对调,第3个与第13个对调。。。。。)

2。随机生成20个100以内的两位正整数,统计其中有多少个不相同的数

3。设有一个2维数组A(5,5),试编写程序计算:
(1)所有元素之和
(2)所有靠边元素之和
(3)两条对角线元素之和

4。按金字塔形状打印杨辉三角形
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1

1.
dim r(15) as integer
dim x,i as integer
dim str1,str2 as string

for i=1 to 15
r(i)=cint(rnd*99+1)
str1=str1 + cstr(r(i)) + " "
next i

text1.text=str1

for i=1 to 7
x=r(i)
r(i)=r(15-i+1)
r(15-i+1)=x
next i

for i=1 to 15
str2=str2 + cstr(r(i)) + " "
next i

text2.text=str2
==============================================
2.
dim r(20) as integer
dim i,j,x as integer

for i=1 to 20
r(i)=cint(rnd*89+10)
next i

for i=1 to 20
for j=i+1 to 20
if r(i)=r(j) then x=x+1
next j
next i

text1.text=20-x '不相同的个数
===============================================
3.

dim r(5,5) as integer
dim i,j,sum as integer
(1):
for i=1 to 5
for j=1 to 5
sum=sum+r(i,j) 'sum为和
next j
next i
(2):
for i=1 to 5