Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[問題]C++的小問題

0 views
Skip to first unread message

白痴天子

unread,
Oct 20, 2000, 2:39:58 AM10/20/00
to
【 在 weych...@bbs.yzu.edu.tw (weychi) 的大作中提到: 】
: char str[5]="stay";
: int num[5]={2,3,4,5,6};
: cout << str << endl;
: cout << num << endl;
: 為什麼str 輸出的是字串
: num輸出的是位址呢?
因為array的名字其實是一個指標變數,而char的輸出是經過cout處理的故輸出字串
而int的array因為其內容的關係,cout無法處理成23456的方式輸出,故輸出位址。
這是我的關念啦,如困有錯的話還請指正......^^

--
[m [1;31m※ 來源:‧玫瑰園資訊站 bbs.ltc.edu.tw‧[FROM: unknown] [m

weychi

unread,
Oct 21, 2000, 1:15:10 AM10/21/00
to
char str[10];

cin >> str; //不能輸入有空白的字串

cin.get(str,10).get(); //這好像在bcb不能使用
cin.getline(str,10); //這好像在bcb也不能使用

那有什麼方法解決輸入有空白的字串呢?
--
[1;32m※ Origin: [33m元智大學 風之塔 [37m<bbs.yzu.edu.tw> [m
[1;32m※ From : [36m140.138.2.219 [m

0 new messages