• 将结构体数组中内容以文件形式的导出


    void fileOutput(contacts student[] , int n){
      ofstream out ;
      out . open("tongxunlu-new.txt") ;
      for(int i = 0 ; i<= n-1 ; i++){
        out << "学号" << ' ' <<' ' << student[i].studentnum << ' ';
        out << "姓名" << ' ' <<' ' << student[i].name << ' ';
        out << "性别" << ' ' <<' ' << student[i].gender << ' ';
        out << "生日" << ' ' <<' ' << student[i].birthday.year <<"年"
                   << student[i].birthday.month <<"月" 

                   << student[i].birthday.day <<"日"

                   << ' ';
        out << "家庭住址" << ' ' <<' ' << student[i].address << ' ';
        out << "QQ号" << ' ' <<' ' << student[i].qqnum << ' ';
        out << "电话号" << ' ' <<' ' << student[i].phonenum << ' ';
        out << "email" << ' '<<' '<< student[i].email << ' '<< ' ';

        }
      out.close();
      cout<<"导出文件成功"<<endl;
    }

  • 相关阅读:
    代码大全2阅读笔记之最后总结
    web商品系统最终版
    web商品系统
    期末总结
    2020/12/13
    2020/12/12
    2020/12/11
    2020/12/10
    2020/12/09
    2020/12/08
  • 原文地址:https://www.cnblogs.com/likeghee/p/10017555.html
Copyright © 2020-2023  润新知