作者katsuoli (katsuo)
看板TransCSI
标题[问题] 高雄大学95计概6,8 97计概1,7
时间Wed Jul 1 21:41:09 2009
终於快做完了,感觉好像都我在洗版--
有没有人要一起对解答的?
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