PCDVD數位科技討論區

PCDVD數位科技討論區 (https://www.pcdvd.com.tw/index.php)
-   疑難雜症區 (https://www.pcdvd.com.tw/forumdisplay.php?f=34)
-   -   VC++的幾個問題part04.. (https://www.pcdvd.com.tw/showthread.php?t=250069)

上善若水 2003-09-23 07:20 PM

harrisonlin 說的比我清楚,多謝了

1. (就如 harrisonlin 兄所說)
雞婆一下給個例子
std::cout << "lalala" << std::endl;
變成了
using namespace std;
cout << "lalala" << endl;

舊的 standard library (xxx.h) 就不需要 using namespace std; 或 加 std:: 了

2. 變數可使用/代表/儲存的範圍和"精確度"
eg.
int/short -32,768 ~ 32,767 (2 or 4 bytes)
long -2,147,483,648 ~ 2,147,483,647 (usually 4 bytes)
float/single 精確至 6 digits 範圍 1e-37 ~ 1e37 (4 bytes)
double 精確至 10 digits 範圍 1e-308 ~ 1e308 (8 bytes)
註 這些範圍和精確度不一定適用每一種電腦
至於 floating-point (real number) 的儲存/精確度其實不簡單
另有一門學問查查書吧

by the way, I can read/write chinese well, (way better than my english)
I typed in English because I can't input Chinese at uni
看的見中文, 但不能打,
中文退步太多, 而且中文打的很慢, 常注音拼不出來 :p

ps. 我是台灣人(屏東) 只是現在住在鳥不生蛋的地方

SGI 2003-09-23 08:31 PM

引用:
Originally posted by 上善若水
harrisonlin 說的比我清楚,多謝了

1. (就如 harrisonlin 兄所說)
雞婆一下給個例子
std::cout << "lalala" << std::endl;
變成了
using namespace std;
cout << "lalala" << endl;

舊的 standard library (xxx.h) 就不需要 using namespace std; 或 加 std:: 了

2. 變數可使用/代表/儲存的範圍和"精確度"
eg.
int/short -32,768 ~ 32,767 (2 or 4 bytes)
long -2,147,483,648 ~ 2,147,483,647 (usually 4 bytes)
float/single 精確至 6 digits 範圍 1e-37 ~ 1e37 (4 bytes)
double 精確至 10 digits 範圍 1e-308 ~ 1e308 (8 bytes)
註 這些範圍和精確度不一定適用每一種電腦
至於 floating-point (real number) 的儲存/精確度其實不簡單
另有一門學問查查書吧

by the way, I can read/write chinese well, (way better than my english)
I typed in English because I can't input Chinese at uni
看的見中文, 但不能打,
中文退步太多, 而且中文打的很慢, 常注音拼不出來 :p

ps. 我是台灣人(屏東) 只是現在住在鳥不生蛋的地方

--------------------------------------------------------------------
1)原來精確度包含這些範圍啊...
不過既然如此,都宣告為double不行了嗎?
"大"包"小"不是嗎?
還是非必要的話,宣告double會占用額外記憶體空間呢?
2)原來大家都是臺灣人,上善若水 兄你也太客氣了
哪兒是鳥不生蛋的地方啊?

harrisonlin 2003-09-23 10:01 PM

引用:
Originally posted by SGI
--------------------------------------------------------------------
1)原來精確度包含這些範圍啊...
不過既然如此,都宣告為double不行了嗎?
"大"包"小"不是嗎?
還是非必要的話,宣告double會占用額外記憶體空間呢?


全都宣告為double,就好像買個菜也開卡車一樣...:) 的確是耗記憶體沒錯!

asccpu 2003-09-23 11:30 PM

引用:
ASM...是指組合語言嗎?
以前有想過要學,但翻了翻對我來說太困難了
畢竟我不是電子電機科班出身的
我是唸機械的當時只學過Pascal及Basic而已(DOS版)

是的,ASM正是組合語言。
其實 SFP(單精度浮點)就夠用了,有時還太多了,它好像是8位小數(DFP倍精度浮點是16位),除非是用在大數計算(如 N! )才用 DFP。
FP(浮點)現都用 IEEE 標準了,以前還出現 MS 格式的,更早的就沒統一了。

上善若水 2003-09-24 04:21 AM

鳥不生蛋的地方啊
you guess loh~~~ :p

SGI 2003-09-24 09:27 AM

引用:
Originally posted by asccpu
是的,ASM正是組合語言。
其實 SFP(單精度浮點)就夠用了,有時還太多了,它好像是8位小數(DFP倍精度浮點是16位),除非是用在大數計算(如 N! )才用 DFP。
FP(浮點)現都用 IEEE 標準了,以前還出現 MS 格式的,更早的就沒統一了。

------------------------------------------------------------------
感謝asccpu兄的插花...
稍微有點兒概念了...


所有的時間均為GMT +8。 現在的時間是09:03 AM.

vBulletin Version 3.0.1
powered_by_vbulletin 2025。