Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main() {
- int arr[5][2]={0,3,33,2,55,0,11,4,22,1};
- ofstream fout ("data.txt",ios::binary);
- fout.write((char*)arr,40);
- fout.close();
- int p = arr[0][1];
- while (p) {
- cout<<arr[p][0]<<endl;
- p = arr[p][1];
- };
- cout<<endl;
- ifstream fin ("data.txt",ios::binary);
- fin.seekg(4);
- fin.read((char*)&p,4);
- while (p) {
- fin.seekg(p*8);
- fin.read((char*)&p,4);
- cout<<p<<endl;
- fin.read((char*)&p,4);
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement