2007年10月26日 星期五

Homework 10-26-2007



Lab average income by gender

Write a program to calculate average income by gender based on the following data, where F stands for female and M for male.

F 62,000
M 25,000
F 38,000
F 43,000
M 65,000
M 120,000
F 80,000
M 30,100

You should be able to allow users to type in a whole line such as F 80,000 followed by next line M 30,100.

第一組資料的輸出







Without any change made to your program, your program should be able to process a new set of data, such as follows:

M 52,000
M 35,000
F 48,000
M 33,000
F 75,000
F 110,000
F 90,000
M 30,100

第二組資料的輸出


Lab Exponential Function


Do Project 7 of Chap. 3. (2nd ed. & 3rd ed.) or Project 4 (1st ed.)

Hint: You don't have to use nested loops.


網路上的定義
可以發現e的一次方為2.71828
當n等於1的時候輸出只有1
1^1/1=1

接著照題目要求輸入n=10
我們可以發現到了第七項

就能得到2.7183這個趨於穩定的值
那接下來的50和100自然也是
再第七項以後基本上就趨於穩定


3 則留言:

Yao Jen 提到...

解說清楚, good job!

Unknown 提到...

酷喔 ^^

-北極熊- 提到...

謝謝老師:)


你也很酷阿XD