(10%)
After you run the following program on a Windows PC, what will be the sizes of "a.txt"
and "b.dat", respectively?
// Size of Files
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
struct Box {
unsigned short length;
unsigned short width;
unsigned short height;
};
int main() {
Box b[] = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} };
FILE* f = fopen("a.txt", "w");
for (size_t i=0; i<sizeof(b)/sizeof(b[0]); ++i)
fprintf(f, "%d %d %d\n",
b[i].length, b[i].width, b[i].height);
fclose(f);
f = fopen("b.dat", "wb");
fwrite(b, sizeof(b[0]), sizeof(b)/sizeof(b[0]), f);
fclose(f);
return 0;
}