1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
class Sdisk
{
public :
Sdisk(string diskname);
Sdisk(string diskname, int numberofblocks, int blocksize);
int getblock(int blocknumber, string& buffer);
int putblock(int blocknumber, string buffer);
private :
string diskname; // file name of software-disk
int numberofblocks; // number of blocks on disk
int blocksize; // block size in bytes
};
Sdisk::Sdisk(string diskname)
{
}
//Sdisk
Sdisk::Sdisk(string diskname, int numberofblocks, int blocksize)
{
}
//getblock
int Sdisk::getblock(int blocknumber, string& buffer)
{
}
//putblock
int Sdisk::putblock(int blocknumber, string buffer)
{
}
int main()
{
Sdisk disk1("test1",16,32);
string block1, block2, block3, block4;
for (int i=1; i<=32; i++) block1=block1+"1";
for (int i=1; i<=32; i++) block2=block2+"2";
disk1.putblock(4,block1);
disk1.getblock(4,block3);
cout << "Should be 32 1s : ";
cout << block3 << endl;
disk1.putblock(8,block2);
disk1.getblock(8,block4);
cout << "Should be 32 2s : ";
cout << block4 << endl;;
}
|