用vb程式設計任意輸入數輸出其中最大值

2021-08-25 17:20:25 字數 3640 閱讀 9246

1樓:桖卉

private sub command1_click()a = val(inputbox("請輸入第一個數"))b = val(inputbox("請輸入第二個數"))print "你輸入的數分別是:"; a; "和"; bprint "其中較大數是:";

if a > b then

print a

else

print b

end if

end sub

2樓:匿名使用者

public function max(a as integer,b as integer,c as integer) as integer

max=iif(a>iif(b>c,b,c),a,iif(b>c,b,c))

end function

使用vb6.0已經測試通過。

3樓:匿名使用者

a=xx

b=yy

c=mm

if a>b then

max=a

else

max=b

end if

if c>max then

max=c

end if

4樓:匿名使用者

vb 裡面有個求最大函式 max(),先比較兩個數,然後把這個結果與第三個數再做一次求最大數不就可以了嗎

vb程式設計題:任意輸入三個數,找出其中最大數?

5樓:匿名使用者

form新增一個按鈕bai,複製du

**,執行zhi,輸出最大數

private sub command1_click()dim a, b, c

a = val(inputbox("請輸dao入專a:"))

b = val(inputbox("請輸入b:"))c = val(inputbox("請輸入c:"))if a < b then a = b

if a < c then a = c

msgbox "最大屬數是: " & a

end sub

6樓:匿名使用者

private sub command1_click()dim a, b, c

a = val(inputbox("請輸bai入duzhia:"))

b = val(inputbox("請輸入b:"))

c = val(inputbox("請輸入c:"))if a>b then d=a

else d=b

if c>d then x= c

else x=c

msgbox "最大數是

dao: " & a

end sub

求編一個 vb程式 任意輸入三個數,找出其中的最大值。

7樓:匿名使用者

dim max%, i%, t$, a

t = inputbox("請輸來入三個數源,中間

bai用空格

du隔開zhi")

a = split(t, " ")

for i = 0 to ubound(a)if a(i) > max then max = a(i)next

msgbox t & " 中最大值是dao:" & vbcrlf & max

8樓:匿名使用者

max=val(inputbox("輸入zhi第一數dao"))a=val(inputbox("輸入第

二數回"))

b=val(inputbox("輸入第三數"))if max

答" & max

9樓:匿名使用者

max=val(inputbox("輸入

du第zhi一數dao"))

a=val(inputbox("輸入第二

專數"))

b=val(inputbox("輸入第三數"))if max

屬" & max

用c語言任意輸入5個數,求其中的最大值,並列印輸出。

10樓:問明

#include<iostream>

usingnamespacestd;

int main()

int a,b,c;

cout<<"輸入五個整數";

cin>>a>>b>>c;

if(a>b)

if(c>a)

cout<<"最大整數是:"<<c<<endl;

else

cout<<"最大整數是:"<<a<<endl;

if(b>a)

if(c>b)

cout<<"最大整數是:"<<c<<endl;

else

cout<<"最大整數是:"<<b<<endl;

return0;

舉例:輸入三個數:

12 45 32

輸出最大數:

11樓:聽不清啊

#include

int main()

printf("最大值=%d\n",max);

return 0;}

基礎vb語言,任意輸入三個數,輸出其中的最大數

12樓:匿名使用者

既然把已經確定的大的數放到變數裡max裡了,那麼後邊的比較就針對max呀???

max = a

if b >= max then

max = b

end if

if c >= max then

max = c

end if

print max

程式設計實現:輸入三個數,要求輸出最大值

13樓:匿名使用者

#include "stdio.h"

int max(int x,int y,int s)//宣告,如果被調函式在主函式後

main()

int a,b,c,d;//定義4個整形變數

scanf("%d,%d,%d",&a,&b,&c);//輸入3個數

d=max(a,b,c);//呼叫max函式,其中3個引數a,b,c,把結果存入變數d中

printf("max=%d",d);//輸出d

getch();

int max(int x,int y, int s) //自定義函式,其中3個形式引數x,y,s

{int z;  //定義實際引數z

if(x>y)z=x;// 如果,x大於y,把x放入z中

else z=y;// 否則把y放入z中

if(y>s)z=y;// 如果y大於s,那麼把y放入z

else z=s;// 否著把s放入z

return(z);//每次比較完返回z

14樓:鬼子君臨天下

public class 三個數最大值 else

}else else

}system.out.print(max);}}

15樓:聽不清啊

#include

int main()

依次將數輸入,要求輸出其中最大的數

可以bai參考下面的 include include int main 擴充套件資du料 c語言isupper 函式 zhi判斷一個dao字內符是否是大寫字容 母c語言isspace 函式 判斷一個字元是否是空白符 c語言isprint 函式 判斷一個字元是否是可列印字元c語言islower 函式 ...

從鍵盤輸入任意自然數,程式設計實現反序輸出(用c 編寫),謝謝

include iostream.h main cout include iostream include string.h using namespace std main cout return 0 include using namespace std int main include inc...

c語言程式設計數a,b,c,d,e由鍵盤輸入,輸出其中最大的

這是一個很簡單的題目 include stdio.h main 題給你寫完了 解決這個的問題的方法有很多這是其一,我沒有執行,你自己除錯一下吧。學習程式語言要多多的進行聯絡,才會不斷地進步。include include void main int max 0,a 5 int i printf 輸入...