首页 > 其他 > 详细

实验7

时间:2018-06-20 19:48:31      阅读:112      评论:0      收藏:0      [点我收藏+]

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); 
}

技术分享图片

实验7

原文:https://www.cnblogs.com/artistqun/p/9205506.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!