zoukankan      html  css  js  c++  java
  • 将结构体数组中内容以文件形式的导出

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

  • 相关阅读:
    4.8日学习
    Apache安装
    HTML5 review
    个人阅读作业LAST
    个人阅读作业Week7
    结对编程:界面模块总结
    个人博客作业Week3
    结对编程博客
    个人博客week2
    软工第一次作业简单总结
  • 原文地址:https://www.cnblogs.com/likeghee/p/10017555.html
Copyright © 2011-2022 走看看