1樓:匿名使用者
開頭你自己寫
中間過程是這樣的!
int s,sum;
s=0;sum=0;
for i=1 to 10
for j=i+1 to 10
s=j*i;
next j;
end;
sum=s+sum;
next i;
end;
2樓:
a = 1
for i = 1 to 10
a = a * i
s = s + a
next i
label1.caption = s
3樓:
private sub command1_click()dim resault as doubledim i as integer
for i = 1 to 10
resault = resault + cal(i)next
end sub
public function cal(num) as doubledim i as integer
dim r as double
r = 1
for i = 1 to num
r = r * i
next
cal = r
end function
4樓:可愛的小知道
p = 1
h = 0
for s = 1 to 10
for ss = 1 to s
p = p * ss
next ss
h = h + p
p = 1
next s
text1.text = h
已經通過vb+6.0
vb程式設計題
5樓:
dim a(1 to 80) as integer
dim js() as integer
dim os() as integer
private sub command1_click()
dim i, j, k
randomize
j = 0
text1.text = ""
for i = 1 to 80
a(i) = int(rnd * 90) + 10
text1.text = text1.text & a(i) & " "
if i mod 10 = 0 then text1.text = text1.text & vbcrlf
if a(i) mod 2 = 1 then
redim preserve js(j)
js(j) = a(i)
j = j + 1
else
redim preserve os(k)
os(k) = a(i)
k = k + 1
end if
next
end sub
private function prime(byval n as long) as boolean '返回值=true是素數,false不是素數
dim k as long
if n < 2 then
prime = false
else
prime = true
for k = 2 to n - 1
if (n mod k) = 0 then prime = false: exit for
next k
end if
end function
private sub command2_click()
dim i, j
for i = 0 to ubound(js)
for j = 0 to i
if js(i) < js(j) then t = js(i): js(i) = js(j): js(j) = t
next
next
text2.text = ""
for i = 0 to ubound(js)
text2.text = text2.text & js(i) & " "
if (i + 1) mod 5 = 0 then text2.text = text2.text & vbcrlf
next
end sub
private sub command3_click()
dim i, j as integer
for i = 0 to ubound(os)
for j = 0 to i
if os(i) > os(j) then t = os(i): os(i) = os(j): os(j) = t
next
next
text3.text = ""
for i = 0 to ubound(os)
text3.text = text3.text & os(i) & " "
if (i + 1) mod 5 = 0 then text3.text = text3.text & vbcrlf
next
end sub
private sub command4_click()
dim i, j, sum as integer
text4.text = ""
j = 0
for i = 0 to ubound(js)
if prime(js(i)) then
text4.text = text4.text & js(i) & " "
j = j + 1
sum = sum + js(i)
if j mod 5 = 0 then text4.text = text4.text & vbcrlf
end if
next
text5.text = j
text6.text = sum
end sub
private sub command5_click()
unload me
end sub
6樓:匿名使用者
設計乙個應用程式,介面如圖8-2(1),窗體內所有控制項字型為宋體、大小為五號,點選「建立檔案」按鈕,則建立陣列num,陣列元素為10個小於100的隨機整數,
vb程式設計題,
7樓:聽不清啊
private sub command1_click()dim a(5, 7)
for i = 1 to 5
for j = 1 to 6
a(i, j) = int(rnd * 9) + 1a(i, 7) = a(i, 7) + a(i, j)print a(i, j);
next j
next i
print: print
for i = 1 to 5
for j = 1 to 6
a(i, 7) = a(i, 7) + a(i, j)print a(i, j);
next j
print a(i, 7)
next i
end sub
8樓:樓磬將流婉
以下兩種方法,都沒有定義使用任何額外變數
方法一:該方法單擊按鈕只能交換一次**
private
subcmd1_click()
pic2.paintpicture
pic1.picture,0,0
pic1.paintpicture
pic2.picture,0,0
endsub
方法專二:該方法可以不屬停的單擊按鈕並交換**,但是用了窗體作為中間交換媒介
private
subcmd1_click()
me.picture
=pic1.picture
pic1.picture
=pic2.picture
pic2.picture
=me.picture
me.picture
=nothing
endsub
9樓:無秉朋佳
這個應該不是很難才對啊
在月份單選按鈕單擊事件中編寫:
option1.caption="opnonth"
text1.text=longdate
這樣應該可以
10樓:王翠帖雯麗
ifopnonth.value=ture
then
label1.text=「現在是某某月」
endif
vb程式設計題目
11樓:鄭桂蘭韶巳
窗體上新增2個文字框和1個按鈕,文字框用來顯示2個同學名字private
subcommand1_click()
'交換名字
dims
asstrings=
text1.text
text1.text
=text2.text
text2.text=s
endsub
vb程式設計題目
12樓:匿名使用者
private sub command1_click()if len(text1) >= 2 thentext1 = left(text1, 2)end if
end sub
private sub command2_click()text1 = ""
end sub
private sub form_load()label1.caption = "新字串"
command1.caption = "左邊2個字元"
command2.caption = "清空"
text1 = ""
'這裡不知道 三號是多大時,可以手動設定文字框字型大小為三號,然後顯示下字型大小,就知道三號字型等於15.75
print text1.fontsize
text1.fontsize = 15.75text1.forecolor = vbredtext1 = "abcdef"
end sub
13樓:竹貞韻祁許
點選窗體顯示前100項
private
function
sl(i%)
ifi=1
then
sl=0
elseif
i=2then
sl=1
elseif
i=3then
sl=1
else
sl=sl(i-3)+2*sl(i-2)+sl(i-1)endfunction
private
subform1_click()
fori=1
to100
sl(i)
next
iend
sub如果要某個值,應該會的吧
14樓:臧嬋娟揚代
(2)新增command1
dima(1
to100)
aslong
dimptr
asinteger
private
subcommand1_click()
a(1)=1
a(2)=1
a(3)=2
forptr=4
to23
a(ptr)=a(ptr-3)+2*a(ptr-2)+a(ptr-1)
next
a(23)
endsub
可以改變迴圈的量求不同的值
(1)dim
result
assouble
result=0.5*sin(47*3.14/180)*13*17面積公式0.5×sinα×ab
15樓:賀淑珍光女
private
subcommand1_click()
dimk%,
sum%
sum=0k
=val(trim(inputbox("請輸入正整數k的值")))fori=1
tolen(str(k))
sum=
sum+
val(mid(str(k),
i,1))
next
imsgbox
sumend
subprivate
subcommand2_click()
dimss=
inputbox("請輸入乙個正整數")
ifstrreverse(s)=s
then
msgboxs&
"是回文數"
else
msgboxs&
"不是回文數"
endif
endsub
private
subcommand3_click()
dimmax%,
a(1to
10)as
integer
randomize
max=
0fori=
1to10a(i)
=int(10
+rnd
*90)
ifmax
anda(i) mod3=0 then max= a(i) nextiif max> 0then msgbox maxelse msgbox "無要找的數" endif endsub private sub form load text1.fontsize 10 end sub private sub command1 click text1.fontsize 10 int rnd 3 1 end sub private sub command2 click text1.font... 夜禮服假面 private sub command1 click dim i as integer,s as integerdim sum as integer dim a as integer,b as integer,c as integer print 100到500所有水仙花數 也叫梅花數 ... private sub command1 click dim obj as object,mymouse as integer if list1.selcount 0 and list2.selcount 0 then for each obj in me.controlsif obj.name l... 您的第乙個問題 text1.text 輸入的數 就是 變數 在文字框裡不是什麼數都可以輸入麼?這就是常量啊!您的第二個問題 當然是寫50 應為val把50轉化了數值 為了方便你理解 我舉兩個例子吧 if val text1.text 60 thenprint pass else print nopa... 太睏了,直接用if語句給你 if ch1.check true thentext1.text 學習程式設計 end if if ch2.check true then end if if ch1.check true and ch2.check true then end if if ch1.che...VB程式設計題目,VB程式設計題?
程式設計vb題程式設計顯示100 500之間所有水仙花數並求
vb程式設計,vb程式設計
vb程式設計題目,VB程式設計試題
請教一道vb題,請教一道vb的程式設計題!!