真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

C語言用函數(shù)計算稅額,c語言稅率計算題目

使用c語言編程,用函數(shù)實(shí)現(xiàn)一個計算器,在主函數(shù)中調(diào)用函數(shù),包括加減乘除,乘方,絕對值和sin函數(shù)。

#includestdio.h

創(chuàng)新互聯(lián)2013年至今,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目做網(wǎng)站、成都網(wǎng)站建設(shè)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元柳北做網(wǎng)站,已為上家服務(wù),為柳北各地企業(yè)和個人服務(wù),聯(lián)系電話:18980820575

#includestdlib.h

double jia(double a,double b)

{

return a+b;

}

double jian(double a,double b)

{

return a-b;

}

double cheng(double a,double b)

{

return a*b;

}

double chu(double a,double b)

{

return a/b;

}

double juedui(double a)

{

return a0 ? a : -a;

}

double chengfang(double a,double b)

{

return pow(a,b);

}

double sinx(double a)

{

return sin(a);

}

int main()

{

int m;

double a,b;

while(1)

{

printf("請輸入第一個操作數(shù):");

scanf("%lf",a);

printf("0、退出\n1、加\n2、減\n3、乘\n4、除\n5、絕對值\n6、乘方\n7sin、\n請選擇一個:");

scanf("%d",m);

if(1==m || 2==m || 3==m || 4==m || 6==m)

{

printf("請輸入第二個操作數(shù):");

scanf("%lf",b);

}

switch(m)

{

case 0:

exit(0);

break;

case 1:

printf("%lf+%lf=%lf\n",a,b,jia(a,b));

break;

case 2:

printf("%lf-%lf=%lf\n",a,b,jian(a,b));

break;

case 3:

printf("%lf*%lf=%lf\n",a,b,cheng(a,b));

break;

case 4:

if(0.0==b)

{

printf("除數(shù)不能為0。\n");

}

else

{

printf("%lf/%lf=%lf\n",a,b,chu(a,b));

}

break;

case 5:

printf("|%lf|=%lf\n",a,juedui(a));

break;

case 6:

printf("%lf的%lf方=%lf\n",a,b,chengfang(a,b));

break;

case 7:

printf("sin(%lf)=%lf\n",a,sinx(a));

break;

default:

printf("無法處理的命令。\n");

break;

}

}

system("PAUSE");

return EXIT_SUCCESS;

}

C語言編程輸入某單位全年應(yīng)納所得額數(shù)目,計算并輸出應(yīng)繳稅額和實(shí)際所得

你看我的理解對不。如果有問題,HI我。

/*表達(dá)的有點(diǎn)不清楚,如果x是20000,按10%算還是按20%算*/

#includestdio.h

int main(void)

{

double tax=0,money,m;

int c;

printf("請輸入全年應(yīng)納所得額數(shù)目:\n");

scanf("%lf",money);

m=money;

if(money/100008)

c=8;

else

c=(int)money/10000;

switch(c)//找到一個入口,順次相加各個級應(yīng)納稅額。

{

case 8:tax+=(money-80000)*0.35;money=80000;

case 7:

case 6:

case 5:

case 4:tax+=(money-40000)*0.30;money=40000;

case 3:

case 2:tax+=(money-20000)*0.20;money=20000;

case 1:tax+=(money-10000)*0.10;money=10000;

case 0:tax+=money*0.05;break;

default:printf("Data Error!\n");

}

printf("應(yīng)納稅額:%.2f\n",tax);

printf("最終所得:%.2f\n",m-tax);

return 0;

}

為了便于你驗(yàn)證程序執(zhí)行結(jié)果:下面的可以多次執(zhí)行,直到你輸入的money不大于0.

#includestdio.h

int main(void)

{

while(1)

{

double tax=0,money,m;

int c;

printf("請輸入全年應(yīng)納所得額數(shù)目:\n");

scanf("%lf",money);

if(money=0)

break;

m=money;

if(money/100008)

c=8;

else

c=(int)money/10000;

switch(c)//找到一個入口,順次相加各個級應(yīng)納稅額。

{

case 8:tax+=(money-80000)*0.35;money=80000;

case 7:

case 6:

case 5:

case 4:tax+=(money-40000)*0.30;money=40000;

case 3:

case 2:tax+=(money-20000)*0.20;money=20000;

case 1:tax+=(money-10000)*0.10;money=10000;

case 0:tax+=money*0.05;break;

default:printf("Data Error!\n");

}

printf("應(yīng)納稅額:%.2f\n",tax);

printf("最終所得:%.2f\n",m-tax);

}

return 0;

}

c語言工資稅收問題

首先,switch適用于處理有明確對比目標(biāo)和對比點(diǎn)的判斷的,比如等于多少的判斷適合用switch,而上面的范圍性的還是用if else比較好,如下:

int r= 0;//去稅額利率

int s = 10000;//工資

float f = 0; //稅后工資總額

if(sprintf("%s","error input number");

else(sr = 1;

else

if(sr = 0.95;

else

if(sr = 0.9;

else

if(sr = 0.85;

else

if(sr = 0.8;

else

r = 0.15;

f = s*r;

最后結(jié)果f就是你的稅后工資總額了。

C語言是一門面向過程、抽象化的通用程序設(shè)計語言,廣泛應(yīng)用于底層開發(fā)。C語言能以簡易的方式編譯、處理低級存儲器。C語言是僅產(chǎn)生少量的機(jī)器語言以及不需要任何運(yùn)行環(huán)境支持便能運(yùn)行的高效率程序設(shè)計語言。盡管C語言提供了許多低級處理的功能,但仍然保持著跨平臺的特性,以一個標(biāo)準(zhǔn)規(guī)格寫出的C語言程序可在包括一些類似嵌入式處理器以及超級計算機(jī)等作業(yè)平臺的許多計算機(jī)平臺上進(jìn)行編譯。

現(xiàn)在最新的C語言標(biāo)準(zhǔn)是C18。

C語言是一門面向過程的計算機(jī)編程語言,與C++、Java等面向?qū)ο缶幊陶Z言有所不同。C語言的設(shè)計目標(biāo)是提供一種能以簡易的方式編譯、處理低級存儲器、僅產(chǎn)生少量的機(jī)器碼以及不需要任何運(yùn)行環(huán)境支持便能運(yùn)行的編程語言。C語言描述問題比匯編語言迅速,工作量小、可讀性好,易于調(diào)試、修改和移植,而代碼質(zhì)量與匯編語言相當(dāng)。

C語言一般只比匯編語言代碼生成的目標(biāo)程序效率低10%~20%。因此,C語言可以編寫系統(tǒng)軟件。

二十世紀(jì)八十年代,美國國家標(biāo)準(zhǔn)局為了避免各開發(fā)廠商用的C語言語法產(chǎn)生差異,給C語言制定了一套完整的美國國家標(biāo)準(zhǔn)語法,稱為ANSI C。作為C語言最初的標(biāo)準(zhǔn)。2011年12月8日,國際標(biāo)準(zhǔn)化組織(ISO)和國際電工委員會(IEC)發(fā)布的C11標(biāo)準(zhǔn)是C語言的第三個官方標(biāo)準(zhǔn),也是C語言的最新標(biāo)準(zhǔn),該標(biāo)準(zhǔn)更好的支持了漢字函數(shù)名和漢字標(biāo)識符,一定程度上實(shí)現(xiàn)了漢字編程。

C語言用函數(shù)strlen計算

C語言規(guī)定,對于沒有明確初始化的部分,默認(rèn)初始化為0, 這個和字符串結(jié)束符\0的值是相同的。

于是str中存的就是

string加上6個\0

而strlen是到\0結(jié)束計算的,這樣,字符串長度就是6

選A

c語言計算器程序設(shè)計包含加減乘除簡單的函數(shù)運(yùn)算

實(shí)用計算器之程序設(shè)計

[摘 要]多用計算器的構(gòu)思及設(shè)計代碼

[關(guān)鍵詞]多用計算器;設(shè)計

數(shù)值計算可以說是日常最頻繁的工作了,WIN98提供了“計算器”軟件供用戶使用,該軟件可以處理一般的一步四則運(yùn)算,例如:3+2、5/3等等,但在日常中用戶經(jīng)常遇到多步四則運(yùn)算問題,例如:3+4*5-4/2,45*34/2+18*7等等,那么該個計算器就無法勝任了,作者制作了一個實(shí)用的計算器,該計算器新增不少功能:(程序界面如圖)

1.可以實(shí)現(xiàn)連續(xù)的四則運(yùn)算

2.可以實(shí)現(xiàn)輸入式子的顯示

3.可以方便計算個人所得稅

4.鼠標(biāo)、鍵盤均可輸入數(shù)據(jù)

5.操作界面友好

6.擊鍵可發(fā)聲

構(gòu)建該個計算器所需研究及解決的核心問題有如下幾個:1、連乘求值?2、字符顯示 3、鍵盤輸入?4、擊鍵發(fā)聲?5、個人所得稅法規(guī),為了使大家對程序有更一步認(rèn)識,現(xiàn)將代碼提供給讀者參考:

*定義數(shù)組及窗體變量

Dim number2(0 To 50) As Double

Dim number(0 To 50) As Double

Dim z As Integer

Dim k As Integer, r As Integer

Dim j As Integer

Dim str As String

*調(diào)用名為“playsound”的API函數(shù)

Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

Private Const SND_FILENAME = H20000?

Private Const SND_ASYNC = H1?

Private Const SND_SYNC = H0

*判斷通用過程

Sub pianduan(p As String)

r = 0

Dim i As Integer, l As Integer, h As Integer

h = 0

i = 1

If InStr(Trim$(p), "*") 0 Then

k = k + 1

End If

If InStr(Trim$(p), "/") 0 Then

r = r + 1

End If

End Sub

*連乘通用過程(略)

*各按鈕事件過程

Private sub Command1_Click(Index As Integer)

PlaySound App.Path "\start.wav", 0, SND_SYNC

Text1.Text = Text1.Text + Command1(Index).Caption

Text2.Text = Text2.Text + Command1(Index).Caption

Text1.SetFocus

End Sub

rivate sub Command10_Click()

PlaySound App.Path "\start.wav", 0, SND_SYNC

str = Text3.Text

End Sub

Private sub Command11_Click()

PlaySound App.Path "\start.wav", 0, SND_SYNC

Text3.Text = str

End Sub

rivate sub Command2_Click()

PlaySound App.Path "\start.wav", 0, SND_SYNC

Dim totle As Double

Dim n As Integer

Call pianduan(Text1.Text)

If k = 1 Or r = 1 Then

Call liancheng(totle)

number2(z) = totle

If Mid$(Trim$(Text1.Text), 1, 1) = "-" Then

number2(z) = -totle

End If

k = 0: r = 0

Else

number2(z) = Val(Text1.Text)

End If

Text1.Text = ""

Text2.Text = Text2 + "+"

z = z + 1

Text1.SetFocus

End Sub

rivate sub Command3_Click()

PlaySound App.Path "\start.wav", 0, SND_SYNC

Dim totle As Double

Dim n As Integer

Call pianduan(Text1.Text)

If k = 1 Or r = 1 Then

Call liancheng(totle)

number2(z) = totle

If Mid$(Trim$(Text1.Text), 1, 1) = "-" Then

number2(z) = -totle

End If

k = 0: r = 0

Else

number2(z) = Val(Text1.Text)

End If

Text1.Text = ""

Text2.Text = Text2 + "-"

Text1.Text = Text1.Text "-"

z = z + 1

Text1.SetFocus

End Sub

Private sub Command4_Click()

PlaySound App.Path "\start.wav", 0, SND_SYNC

Text2.Text = Text2.Text + "*"

Text1.Text = Text1.Text + "*"

Text1.SetFocus

End Sub

rivate sub Command5_Click()

PlaySound App.Path "\start.wav", 0, SND_SYNC

Text2.Text = Text2 + "/"

Text1.Text = Text1 + "/"

Text1.SetFocus

End Sub

Private sub Command6_Click()

PlaySound App.Path "\sound.wav", 0, SND_SYNC

Dim totle As Double

Dim n As Integer

Call pianduan(Text1.Text)

If k = 1 Or r = 1 Then

Call liancheng(totle)

number2(z) = totle

If Mid$(Trim$(Text1.Text), 1, 1) = "-" Then

number2(z) = -totle

End If

k = 0: r = 0

Else

number2(z) = Val(Text1.Text)

End If

Text1.Text = ""

z = z + 1

Dim dengyu As Double

Dim v As Integer

For v = 0 To 50

dengyu = dengyu + number2(v)

Next v

If dengyu 0 Then

Text3.ForeColor = HFF

Else

Text3.ForeColor = HFF0000

End If

Text3.Text = dengyu

Text1.SetFocus

If Len(Text3.Text) = 14 Then

calcresult.Show

End If

End Sub

rivate sub Command7_Click()

PlaySound App.Path "\start.wav", 0, SND_SYNC

z = 0: k = 0: r = 0: j = 0

Dim i As Integer

For i = 0 To 50

number(i) = 0

number2(i) = 0

Next i

Text1.Text = ""

Text2.Text = ""

Text3.Text = ""

Text1.SetFocus

End Sub

rivate sub Command8_Click()

PlaySound App.Path "\start.wav", 0, SND_SYNC

If Val(Text3.Text) = 0 Then

MsgBox "除數(shù)不能為0!"

Exit Sub

End If

Text3.Text = 1 / Val(Text3.Text)

End Sub

Private sub Command9_Click()

PlaySound App.Path "\start.wav", 0, SND_SYNC

Text3.ForeColor = HFF0000

Text3.Text = Val(Text3.Text) * Val(Text3.Text)

End Sub

rivate sub muninternet_Click()

Dim i

i = Shell("C:\Program Files\InternetExplorer\iexplore.exe", vbMaximizedFocus)

End Sub

rivate sub munmp3_Click()

Dim i

i = Shell("C:\Program Files\Windows Media Player\mplayer2", vbNormalNoFocus)

End Sub

Private sub munsm_Click()

Dialog.Show

End Sub

rivate sub muntax_Click()

tax.Show

End Sub

rivate sub munver_Click()

ver.Show

End Sub

rivate sub notepad_Click()

Dim i

i = Shell("c:\windows\notepad", vbNormalFocus)

End Sub

Private sub Text1_KeyPress(KeyAscii As Integer)

PlaySound App.Path "\start.wav", 0, SND_SYNC

Dim num As Integer

num = Val(KeyAscii)

If num 47 And num 58 Then

Text1.Text = Text1.Text + CStr(num - 48)

Text2.Text = Text2.Text + CStr(num - 48)

End If

If num = 46 Then

Text1.Text = Text1.Text + "."

Text2.Text = Text2.Text + "."

End If

If KeyAscii = 43 Then

Dim totle As Double

Dim n As Integer

Call pianduan(Text1.Text)

If k = 1 Or r = 1 Then

Call liancheng(totle)

number2(z) = totle

If Mid$(Trim$(Text1.Text), 1, 1) = "-" Then

number2(z) = -totle

End If

k = 0: r = 0

Else

number2(z) = Val(Text1.Text)

End If

Text1.Text = ""

Text2.Text = Text2 + "+"

z = z + 1

End If

If KeyAscii = 45 Then

Call pianduan(Text1.Text)

If k = 1 Or r = 1 Then

Call liancheng(totle)

number2(z) = totle

If Mid$(Trim$(Text1.Text), 1, 1) = "-" Then

number2(z) = -totle

End If

k = 0: r = 0

Else

number2(z) = Val(Text1.Text)

End If

Text1.Text = ""

Text2.Text = Text2 + "-"

Text1.Text = Text1.Text "-"

z = z + 1

End If

If KeyAscii = 42 Then

Text2.Text = Text2.Text + "*"

Text1.Text = Text1.Text + "*"

End If

If KeyAscii = 47 Then

Text2.Text = Text2.Text + "/"

Text1.Text = Text1.Text + "/"

End If

If KeyAscii = vbKeyReturn Then

PlaySound App.Path "\sound.wav", 0, SND_SYNC

Call pianduan(Text1.Text)

If k = 1 Or r = 1 Then

Call liancheng(totle)

number2(z) = totle

If Mid$(Trim$(Text1.Text), 1, 1) = "-" Then

number2(z) = -totle

End If

k = 0: r = 0

Else

number2(z) = Val(Text1.Text)

End If

Text1.Text = ""

z = z + 1

Dim dengyu As Double

Dim v As Integer

For v = 0 To 50

dengyu = dengyu + number2(v)

Next v

If dengyu 0 Then

Text3.ForeColor = HFF

Else

Text3.ForeColor = HFF0000

End If

Text3.Text = dengyu

End If

If KeyAscii = vbKeyEscape Then

z = 0: k = 0: r = 0: j = 0

Dim i As Integer

For i = 0 To 50

number(i) = 0

number2(i) = 0

Next i

Text1.Text = ""

Text2.Text = ""

Text3.Text = ""

Text1.SetFocus

End If

If Len(Text3.Text) = 14 Then

calcresult.Show

End If

End Sub

rivate sub Text3_Change()

tax2.Text1 = Text3.Text

End Sub

c語言工資納稅系統(tǒng)

#define gongzi a

#define b 1600

#includestdio.h

#include"工資納稅系統(tǒng).h"

void main()

{

double f(int a);

int a;

float c;

printf("\n請輸入工資:");

scanf("%d",gongzi);

c=f(gongzi);

printf("應(yīng)納稅所得額為:%.2f\n",gongzi-c);

}

double f(int gongzi)

{

double z;

int x;

x=gongzi-b;

if(gongzib)

z=0;

else if(x500)

z=x*0.05;

else if(x2000)

z=500*0.05+(x-500)*0.1;

else if(x5000)

z=500*0.05+1500*0.1+(x-2000)*0.15;

else if(x20000)

z=500*0.05+1500*0.1+3000*0.15+(x-5000)*0.2;

else if(x40000)

z=500*0.05+1500*0.1+3000*0.15+15000*0.2+(x-20000)*0.25;

else if(x60000)

z=500*0.05+1500*0.1+3000*0.15+15000*0.2+20000*0.25+(x-40000)*0.3;

else if(x80000)

z=500*0.05+1500*0.1+3000*0.15+15000*0.2+20000*0.25+20000*0.3+(x-60000)*0.35;

else if(x100000)

z=500*0.05+1500*0.1+3000*0.15+15000*0.2+20000*0.25+20000*0.3+20000*0.35+(x-80000)*0.4;

else

z=500*0.05+1500*0.1+3000*0.15+15000*0.2+20000*0.25+20000*0.3+20000*0.35+20000*0.4+(x-100000)*0.45;

return(z);

}


本文標(biāo)題:C語言用函數(shù)計算稅額,c語言稅率計算題目
文章出自:http://weahome.cn/article/dscgcjh.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部