• 7.14


    #include <iostream>
    #include <fstream>
    using namespace std;
    struct list{
        char course[15];
        int score;
    };
    int main(){
        list list2[2];
        ifstream in("f4.dat",ios::binary);
        if(!in)
        {
            cout<<"Cannot open input file. ";
            return 1;
        }
        for(int i=0;i<2;i++)
        {
            in.read((char*)&list2[i],sizeof(list2[i]));
            cout<<list2[i].course<<" "<<list2[i].score<<endl;
        }
        in.close();
        return 0;
    }
  • 相关阅读:
    String,StringBuffer与StringBuilder的区别?
    Digui
    Digui1
    逆序
    TestOverWrite
    DemoBoxWeight
    TestSuperSub
    Cast
    TestOverWrite
    Joseph
  • 原文地址:https://www.cnblogs.com/wangjianupc/p/10587223.html
Copyright © 2020-2023  润新知