看板 TransCSI 關於我們 聯絡資訊
終於快做完了,感覺好像都我在洗版-- 有沒有人要一起對解答的? http://www2.nuk.edu.tw/lib/exam/95/trans2/95cs(2)-trf.pdf 95計概 http://www2.nuk.edu.tw/lib/exam/96/trans2/96cs(2)-trf.pdf 96計概 95計概 6. 我的答案 &x 001234 &xPtr 002468 *xPtr 001234 &*xPtr 001234 *x 001234 (我不知道這個小題跟第一題的差異在哪裡) 這一題我觀念轉不過來,有大大可以解釋一下嗎,我再想這題的時候腦袋打結了 -- 我用程式下去跑,因為我不確定我的答案對不對 #include<stdio.h> #include<stdlib.h> int x=5; int *xPtr; main() { x=x+5; xPtr=&x; printf("%d\n",&x); printf("%d\n",&xPtr); printf("%d\n",xPtr); printf("%d\n",&*xPtr); printf("%d\n",*x); system("pause"); return 0; } 結果顯示 &x = xPtr =&*xPtr *x沒辦法跑他說違法 &xPtr就是他自己的位址 8.What is the content of the variable"number" after executing the following C program? #include<stdio.h> int cubeByReference(int *nPtr); int main() { int result,number=5; printf("The original value of number is %d",number); result=cubeByReference(&number); printf("\nThe new value of number is %d\n",number); return 0; } int cubeByReference(int *nPtr) { return *nPtr**nPtr**nPtr; } 基本上程式跑出來是5 可是我總覺得是125 有人可以大概解釋一下嗎? 96.計概 1. (a) Show a truth table for the following circuit diagram. (5%) (b) Draw a circuit diagram that is logically equivalent to the following circuit and uses only one NAND gate and one NOT gate 我用布林運算計算出來的結果 ______ _ A+B‧B 然後我不知道怎麼辦了.... 7.Write a function in C or Java that accepts integer n as an input and returns the following result 1 1 1 1 - + --- + ------ +.....+ ----------- 1 1+2 1+2+3 1+2+...+n 這題我想了一天還是沒頭緒 做完這四份考古題其實我蠻灰心的,總覺得好像很多都是基本題,結果自己就是沒辦法會 唉.... 總之,還是麻煩各位幫忙了。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.167.169.139