文件

发布时间 2023-05-05 21:27:49作者: 艾鑫4646
#include<iostream>
using namespace std;
#include<fstream>
test01(){
    ofstream ofs;
    ofs.open("test.txt",ios::out);
    ofs<<"姓名"<<endl;
    ofs<<"性别"<<endl; 
    ofs.close();
}
test02(){
    ifstream ifs;
    ifs.open("test.txt",ios::in);
    string bug;
    while(getline(ifs,bug)){
        cout<<bug<<endl;
    }
    ifs.close();
}
int main(){
    test01();
    test02();
    system("pause");
    return 0;
}