自拍偷在线精品自拍偷|国产无码一区二区久久|最新版天堂资源中文官网|国产精品第一页爽爽影院|国产精品一区二区av不卡|久久久波多野av一区无码|国产欧美日本亚洲精品一4区|亚洲精品天堂在线观看2020

當(dāng)前位置:首頁(yè) > 軟件開(kāi)放 > 正文內(nèi)容

微信小程序簡(jiǎn)易計(jì)算器代碼(小程序?qū)崿F(xiàn)計(jì)算器)

軟件開(kāi)放2年前 (2023-04-06)1543

今天給各位分享微信小程序簡(jiǎn)易計(jì)算器代碼的知識(shí),其中也會(huì)對(duì)小程序?qū)崿F(xiàn)計(jì)算器進(jìn)行解釋?zhuān)绻芘銮山鉀Q你現(xiàn)在面臨的問(wèn)題,別忘了關(guān)注本站,現(xiàn)在開(kāi)始吧!

本文目錄一覽:

用js代碼做一個(gè)簡(jiǎn)易計(jì)算器

function?test(){

?????var?txt1?=?document.getElementById("txt1"),

?????????txt2?=?document.getElementById("txt2"),

?????????txt3?=?document.getElementById("txt3"),

?????????opt??=?document.getElementById("sel");

?????txt3.value?=??eval(txt1.value?+?opt.value?+?txt2.value);//eval函數(shù)可計(jì)算某個(gè)字符串,并執(zhí)行其中的的js代碼

}

input?type="text"?id="txt1"?/

select?id="sel"

?????option?value="+"+/option

?????option?value="-"-/option

?????option?value="*"*/option

?????option?value="/"http://option

/select

input?type="text"?id="txt2"?/

=

input?type="text"?id="txt3"?/

input?type="button"?id="btn"?value="計(jì)算"?onclick="test()"/

用C語(yǔ)言編一個(gè)簡(jiǎn)單的計(jì)算器小程序

你說(shuō)的是 vc 還是 tc 啊???

其他的運(yùn)算:

#include stdio.h

int add(int x,int y) {return x+y;}

int sub(int x,int y) {return x-y;}

int mul(int x,int y) {return x*y;}

int div(int x,int y) {return x/y;}

int (*func[])()={add,sub,mul,div};

int num,curch;

char chtbl[]="+-*/()=";

char corch[]="+-*/()=0123456789";

int getach() {

int i;

while(1) {

curch=getchar();

if(curch==EOF) return -1;

for(i=0;corch[i]curch!=corch[i];i++);

if(istrlen(corch)) break;

}

return curch;

}

int getid() {

int i;

if(curch='0'curch='9') {

for(num=0;curch='0'curch='9';getach()) num=10*num+curch-'0';

return -1;

}

else {

for(i=0;chtbl[i];i++) if(chtbl[i]==curch) break;

if(i=5) getach();

return i;

}

}

int cal() {

int x1,x2,x3,op1,op2,i;

i=getid();

if(i==4) x1=cal(); else x1=num;

op1=getid();

if(op1=5) return x1;

i=getid();

if(i==4) x2=cal(); else x2=num;

op2=getid();

while(op2=4) {

i=getid();

if(i==4) x3=cal(); else x3=num;

if((op1/2==0)(op2/2==1)) x2=(*func[op2])(x2,x3);

else {

x1=(*func[op1])(x1,x2);

x2=x3;

op1=op2;

}

op2=getid();

}

return (*func[op1])(x1,x2);

}

void main(void) {

int value;

printf("Please input an expression:\n");

getach();

while(curch!='=') {

value=cal();

printf("The result is:%d\n",value);

printf("Please input an expression:\n");

getach();

}

}

只能 + - * /

簡(jiǎn)易計(jì)算器代碼

我的計(jì)算器 Option Explicit Dim FocusText As VB.TextBox Dim pd As Boolean Dim x As Double Dim y As Double Dim ch As Integer Private Sub Command1_Click(Index As Integer) On Error Resume Next FocusText.SetFocus If Index SendKeys Index ElseIf Index = 10 Then ch = Index - 10 x = Val(Text1.Text) Text1.Text = "" ElseIf Index = 14 Then y = Val(Text1.Text) Select Case ch Case 0 Text1.Text = x + y Case 1 Text1.Text = x - y Case 2 Text1.Text = x * y Case 3 Text1.Text = x / y End Select ElseIf Index = 15 Then FocusText.SetFocus SendKeys "{BS}" ElseIf Index = 16 Then FocusText.SetFocus SendKeys "." End If End Sub '防止輸入多個(gè)小數(shù)點(diǎn)以及出數(shù)字外的其他字符 Private Sub Text1_KeyPress(KeyAscii As Integer) If (KeyAscii 57) And KeyAscii 46 And KeyAscii 8 Then KeyAscii = 0 End If If pd = True And KeyAscii = 46 Then KeyAscii = 0 End If If pd = False And KeyAscii = 46 Then pd = True KeyAscii = 46 End If End Sub '防止 Ctrl + v 粘貼 Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyV And Shift = vbCtrlMask Then Text1.Enabled = False Clipboard.Clear Text1.Enabled = True End If End Sub '防止右鍵粘貼 Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) If Button = vbRightButton Then Text1.Enabled = False Clipboard.Clear Text1.Enabled = True End If End Sub Private Sub Text1_LostFocus() Set FocusText = Text1 End Sub 界面如下 0為Command1(0)1為Command1(1)依次類(lèi)推 ←為Command1(15) 小數(shù)點(diǎn)為Command1(16) 貼子相關(guān)圖片: 界面可以到

vb:簡(jiǎn)易計(jì)算器(加減乘除)代碼

代碼如下:

Dim t, t1 As Integer

Dim x, y As Double

Public Sub com()

x = Val(l1.Caption)

Select Case t1

Case Is = 1: y = y + x

Case Is = 2: y = y - x

Case Is = 3: y = y * x

Case Is = 4: y = y / x

End Select

t1 = 0

t = 0

l1.Caption = "0"

End Sub

Private Sub Form_Load()

x = 0

y = 0

t = 0

t1 = 1

End Sub

Private Sub c0_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "0"

Else

l1.Caption = l1.Caption + "0"

End If

End Sub

Private Sub C1_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "1"

Else

l1.Caption = l1.Caption + "1"

End If

End Sub

Private Sub c10_Click(Index As Integer)

If t = 0 Then

l1.Caption = l1.Caption + "."

t = 1

End If

End Sub

Private Sub C2_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "2"

Else

l1.Caption = l1.Caption + "2"

End If

End Sub

Private Sub C3_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "3"

Else

l1.Caption = l1.Caption + "3"

End If

End Sub

Private Sub C4_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "4"

Else

l1.Caption = l1.Caption + "4"

End If

End Sub

Private Sub C5_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "5"

Else

l1.Caption = l1.Caption + "5"

End If

End Sub

Private Sub C6_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "6"

Else

l1.Caption = l1.Caption + "6"

End If

End Sub

Private Sub C7_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "7"

Else

l1.Caption = l1.Caption + "7"

End If

End Sub

Private Sub C8_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "8"

Else

l1.Caption = l1.Caption + "8"

End If

End Sub

Private Sub C9_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "9"

Else

l1.Caption = l1.Caption + "9"

End If

End Sub

Private Sub z1_Click(Index As Integer)

com

t1 = 1

End Sub

Private Sub z2_Click(Index As Integer)

com

t1 = 2

End Sub

Private Sub z3_Click(Index As Integer)

com

t1 = 3

End Sub

Private Sub z4_Click(Index As Integer)

com

t1 = 4

End Sub

Private Sub z5_Click(Index As Integer)

tmp = Mid(l1.Caption, Len(l1.Caption), 1)

If tmp = "." Then

t = 0

End If

If Len(l1.Caption) = 1 Then

l1.Caption = "0"

Else

l1.Caption = Left(l1.Caption, Len(l1.Caption) - 1)

End If

End Sub

Private Sub z6_Click(Index As Integer)

l1.Caption = "0"

Form_Load

End Sub

Private Sub z7_Click(Index As Integer)

If (l1.Caption "0") Then

l1.Caption = "-" + l1.Caption

End If

End Sub

Private Sub z8_Click(Index As Integer)

com

l1.Caption = Str(y)

End Sub

擴(kuò)展資料

語(yǔ)言缺點(diǎn)

Visual Basic 語(yǔ)言具有不支持繼承、無(wú)原生支持多線(xiàn)程、異常處理不完善等三項(xiàng)明顯缺點(diǎn),使其有所局限性(此些缺點(diǎn)皆已在 vb .net 獲得改進(jìn))。

不支持繼承

VB 5.0 和 VB 6.0 都是基于對(duì)象的編程語(yǔ)言,但是不包含繼承特性。VB 中提供了特殊的類(lèi)的功能,但是還是不能滿(mǎn)足程序員的需求。

無(wú)原生支持多線(xiàn)程

Visual Basic 對(duì)于多線(xiàn)程無(wú)原生支持,只能通過(guò)Windows API的調(diào)用實(shí)現(xiàn),且極其的不穩(wěn)定。因?yàn)樵贏(yíng)PI創(chuàng)建的線(xiàn)程中,并沒(méi)有自動(dòng)初始化運(yùn)行時(shí)庫(kù),導(dǎo)致部分的函數(shù)無(wú)法使用。一般的,在VB6等早期的VB開(kāi)發(fā)環(huán)境下,使用API創(chuàng)建線(xiàn)程的目的是完成容易使程序假死的大量數(shù)據(jù)或者邏輯的計(jì)算。

異常處理不完善

Visual Basic 中內(nèi)置異常處理,即使未寫(xiě)異常處理代碼,一旦用戶(hù)出錯(cuò)也會(huì)彈出一個(gè)明確寫(xiě)出出錯(cuò)原因?qū)υ?huà)框,接著程序終止。

Visual Basic 中可以使用 Err.Raise拋出異常。對(duì)系統(tǒng)及用戶(hù)拋出的異常的處理常用兩種模式:一是使用 On Error Resume Next 處理錯(cuò)誤;另一種是使用 On Error Goto 將運(yùn)行引入錯(cuò)誤處理代碼。但相對(duì) C++ 等語(yǔ)言而言,這樣的異常處理破壞了代碼的結(jié)構(gòu)。

參考資料:百度百科-VB

微信小程序簡(jiǎn)易計(jì)算器代碼的介紹就聊到這里吧,感謝你花時(shí)間閱讀本站內(nèi)容,更多關(guān)于小程序?qū)崿F(xiàn)計(jì)算器、微信小程序簡(jiǎn)易計(jì)算器代碼的信息別忘了在本站進(jìn)行查找喔。

掃描二維碼推送至手機(jī)訪(fǎng)問(wèn)。

版權(quán)聲明:本文由飛速云SEO網(wǎng)絡(luò)優(yōu)化推廣發(fā)布,如需轉(zhuǎn)載請(qǐng)注明出處。

本文鏈接:http://m.thonggone.com/post/15572.html

“微信小程序簡(jiǎn)易計(jì)算器代碼(小程序?qū)崿F(xiàn)計(jì)算器)” 的相關(guān)文章

制作一個(gè)手機(jī)app軟件需要多少錢(qián)(怎么制作app軟件需要多少錢(qián))

制作一個(gè)手機(jī)app軟件需要多少錢(qián)(怎么制作app軟件需要多少錢(qián))

本篇文章給大家談?wù)勚谱饕粋€(gè)手機(jī)app軟件需要多少錢(qián),以及怎么制作app軟件需要多少錢(qián)對(duì)應(yīng)的知識(shí)點(diǎn),希望對(duì)各位有所幫助,不要忘了收藏本站喔。 本文目錄一覽: 1、誰(shuí)知道定制一個(gè)app軟件需要多少錢(qián)? 2、制作一個(gè)app需要多少錢(qián)? 3、開(kāi)發(fā)一個(gè)app需多少錢(qián) 4、做一個(gè)簡(jiǎn)單的app系統(tǒng)軟件...

油猴屏蔽網(wǎng)頁(yè)廣告腳本(瀏覽器去廣告腳本)

油猴屏蔽網(wǎng)頁(yè)廣告腳本(瀏覽器去廣告腳本)

今天給各位分享油猴屏蔽網(wǎng)頁(yè)廣告腳本的知識(shí),其中也會(huì)對(duì)瀏覽器去廣告腳本進(jìn)行解釋?zhuān)绻芘銮山鉀Q你現(xiàn)在面臨的問(wèn)題,別忘了關(guān)注本站,現(xiàn)在開(kāi)始吧!本文目錄一覽: 1、油猴上腳本已啟動(dòng),點(diǎn)開(kāi)學(xué)習(xí)通視頻卻沒(méi)自動(dòng)跳過(guò)怎么回事 2、如何刪除網(wǎng)頁(yè)中殘余的油猴腳本? 3、安卓adguard用不了油猴腳本 4...

手機(jī)百度瀏覽器收藏刪除了怎么恢復(fù)(手機(jī)百度刪除的收藏怎么恢復(fù))

手機(jī)百度瀏覽器收藏刪除了怎么恢復(fù)(手機(jī)百度刪除的收藏怎么恢復(fù))

今天給各位分享手機(jī)百度瀏覽器收藏刪除了怎么恢復(fù)的知識(shí),其中也會(huì)對(duì)手機(jī)百度刪除的收藏怎么恢復(fù)進(jìn)行解釋?zhuān)绻芘銮山鉀Q你現(xiàn)在面臨的問(wèn)題,別忘了關(guān)注本站,現(xiàn)在開(kāi)始吧!本文目錄一覽: 1、百度瀏覽器收藏誤刪怎么找回 2、手機(jī)百度瀏覽記錄怎么恢復(fù) 3、手機(jī)瀏覽器刪掉怎么找回收藏的網(wǎng)址 4、手機(jī)百度...

十大手游交易平臺(tái)排行榜dd373(十大可交易的手游平臺(tái))

十大手游交易平臺(tái)排行榜dd373(十大可交易的手游平臺(tái))

本篇文章給大家談?wù)勈笫钟谓灰灼脚_(tái)排行榜dd373,以及十大可交易的手游平臺(tái)對(duì)應(yīng)的知識(shí)點(diǎn),希望對(duì)各位有所幫助,不要忘了收藏本站喔。 本文目錄一覽: 1、手游在哪里交易 2、游戲交易平臺(tái)有哪些? 3、賣(mài)游戲賬號(hào)哪個(gè)平臺(tái)好? 4、手游交易平臺(tái)哪個(gè)好 5、游戲幣交易平臺(tái)哪個(gè)最好? 手游在...

URL不合法怎么辦(url有問(wèn)題怎么辦)

URL不合法怎么辦(url有問(wèn)題怎么辦)

今天給各位分享URL不合法怎么辦的知識(shí),其中也會(huì)對(duì)url有問(wèn)題怎么辦進(jìn)行解釋?zhuān)绻芘銮山鉀Q你現(xiàn)在面臨的問(wèn)題,別忘了關(guān)注本站,現(xiàn)在開(kāi)始吧!本文目錄一覽: 1、URL不合法怎么辦? 2、URL不合法啥意思 3、url不合法是怎么回事? URL不合法怎么辦? URL就是能獲取你要下載的資源的下...