綁定帳號登入

Android 台灣中文網

打印 上一主題 下一主題

[其他] 有人可以幫我解C++的題目嗎? 很急~~~

 關閉 [複製連結] 查看: 1160|回覆: 2|好評: 0
跳轉到指定樓層
樓主
hanklai02 | 收聽TA | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
發表於 2016-7-22 09:56
提示: 作者被禁止或刪除 內容自動屏蔽
收藏收藏 分享分享 分享專題
用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

沙發
王睿增 | 收聽TA | 只看該作者
發表於 2016-7-22 09:56
我會
簡單

評分

參與人數 1碎鑽 +1 幫助 +1 收起 理由
hanklai02 + 1 + 1 非常讃

查看全部評分

用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

板凳
kirito881108 | 收聽TA | 只看該作者
發表於 2016-7-23 16:25
C++ Programming for Teens
Final Examination on July 22, 2016
Summer 2016
Department of Computer Science & Information Engineering
National Taiwan University
Problem 1 (20 points) 撰寫一個程式加總輸入的正整數的每一位數,並將其結
果輸出在螢幕上。例如:
1 Enter a positive integer ? 12345
2 Sum = 15
Problem 2 (20 points) 撰寫一個函數計算輸入值的正平方根,並且執行方式如
下:
1 >> mySqrt 10
2 sqrt ( 1 0 ) = 3. 1 6 2 2 7 7 6 6 0 1
3 >> mySqrt 0. 1
4 sqrt ( 1 0 ) = 0. 3 1 6 2 2 7 7 6 6 0
注意,程式不得使用sqrt之類的數學函數。提示:利用Bisection method。
1 #include <iostream>
2
3 d ouble mySqrt ( d ouble x ) ;
4
5 i n t main ( i n t argc , ch a r ∗∗ argv ) {
6 /∗ your work ∗/
7 r e t u r n 1 ;
8 }
9
10 d ouble mySqrt ( d ouble x ) {
11 /∗ your work ∗/
12 }
Problem 3 (20 points)
(1) 撰寫一個程式計算x
n的結果,其中x為任意實數,n為任意整數。
(2) 此程式的時間複雜度為? (在螢幕上最後一行輸出O(g(n))即可,其中g(n)是
你認為你的程式可以被歸類於此的簡單函數。)
1
1 #include <iostream>
2
3 i n t myPow ( d ouble , i n t ) ;
4
5 i n t main ( ) {
6 std : : cout << myPow ( 2 , −10) ;
7 r e t u r n 1 ;
8 }
9
10 i n t myPow ( d ouble x , i n t n ) {
11 /∗ your work ∗/
12 }
Problem 4 (20 points) 撰寫一個程式展示bubble sort的演算法。第一,先產生
一個亂數陣列,假設長度為10且成員皆為整數。第二,透過指標(pointer)將一維
陣列(array)從main function傳給函數bubbleSort。最後,在螢幕上顯示排序前後
的結果。
1 #include <iostream>
2
3 /∗ your work ∗/
4
5 i n t main ( ) {
6 /∗ your work ∗/
7 r e t u r n 1 ;
8 }
9
10 /∗ your work ∗/
Problem 5 (20 points) 撰寫一個程式隨機產生一組四個相異正整數,皆介
於0, 1, 2, . . . , 9之間。執行方法如下:
1 >> randomSeq
2 5 7 1 2
3 >> randomSeq
4 0 4 7 3
Problem 6 (20 points) 填寫問卷者,可獲得額外的20分。連結:https://
docs.google.com/forms/d/e/1FAIpQLSfUJWQJw-oRUhNR4l-iwTWhdgJnj6IgpYAKg_
hiHIGMaCbdxA/viewform
SUBMISSION
1. Pack source codes into a zip or rar file with your full name.
2
2. Do not attach the executable files.
3. Send the zip/rar file to [email protected].
4. If you have any suggestion for improving this class, feel free to leave your
feedback in the e-mail.
Congratulations!!!
“To start, you don’t have to be good;
to be good, you have to start.”
– Slogan of NTU Toastmasters

評分

參與人數 1碎鑽 +1 幫助 +1 收起 理由
woolala + 1 + 1 非常讃

查看全部評分

用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則