相关文章推荐
睿智的领结  ·  Add or connect a ...·  5 月前    · 
英勇无比的烈酒  ·  python 两个list ...·  1 年前    · 
心软的香菜  ·  MATLAB ...·  1 年前    · 
cout << "eCash: 帳號不存在,第一次使用!\n" << endl; cout << str <<"您好,請選擇項目:" << endl; cout << "s: 儲值\np: 消費\nd: 查詢餘額\nq: 離開\n" << endl ; while(flog != 0){ cin >> c; if(c == 's'){cout << "請輸入儲存金額:" << endl; p1.store(); if(c == 'p'){cout << "請輸入消費金額:" << endl; p1.pay(); if(c == 'd'){ p1.display(); if(c == 'q'){ cout << "eCash: 帳號登出,已存檔!\n謝謝 , Bye Bye!" << endl; break; return 0;

可以參考 std::fstream - C++ Reference 其中的用法範例

std::fstream fs("filename", std::fstream::in | std::fstream::out);
/* 對 fs 操作 */
fs.close();