标签:fst sci image 技术分享 flags col ret origin txt
11.3
#include<iostream> #include<fstream> using namespace std; int main() { ofstream test("test1.txt"); test<< "已成功写入文件!"; test.close(); return 0; }
11.4
#include<fstream> #include<iostream> using namespace std; int main(){ char ch; ifstream test1("test.txt"); while(test1.get(ch)) cout<<ch; test1.close(); }
11.7
#include <iostream> using namespace ::std; int main() { ios_base::fmtflags original_flags = cout.flags(); cout<< 812<<‘|‘; cout.setf(ios_base::left,ios_base::adjustfield); cout.width(10); cout<<813<<815<<‘\n‘; cout.unsetf(ios_base::adjustfield); cout.precision(2); cout.setf(ios_base::uppercase|ios_base::scientific); cout << 831.0 ; cout.flags(original_flags); }
标签:fst sci image 技术分享 flags col ret origin txt
原文地址:https://www.cnblogs.com/artistqun/p/9205506.html