[問題] 用 fstream 讀入類別並呼叫成員函式
看板C_and_CPP (C/C++)作者sherrypenelo (sherry)時間13年前 (2013/04/28 13:34)推噓2(2推 0噓 8→)留言10則, 6人參與討論串1/2 (看更多)
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Linux
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
無
問題(Question):
請問如果在int main檔裡寫ifstream INPUT("Input.txt",ios::in)
要怎麼用input.txt裡的函式functionINInputFile??
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
error. input not declared in this scope
程式碼(Code):(請善用置底文網頁, 記得排版)
Input.txt
class Input{
functionINInputFile();
};
main.cpp
class AOB{
ifstream input("Input.txt",ios::in);
input IN;
IN.functionINInputFile;
};
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.116.123.175
→
04/28 13:52, , 1F
04/28 13:52, 1F
→
04/28 14:44, , 2F
04/28 14:44, 2F
→
04/28 16:34, , 3F
04/28 16:34, 3F
→
04/28 16:44, , 4F
04/28 16:44, 4F
推
04/28 17:34, , 5F
04/28 17:34, 5F
→
04/28 18:02, , 6F
04/28 18:02, 6F
→
04/28 18:04, , 7F
04/28 18:04, 7F
→
04/28 18:05, , 8F
04/28 18:05, 8F
推
04/28 18:51, , 9F
04/28 18:51, 9F
→
04/28 19:37, , 10F
04/28 19:37, 10F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章