DATA FILE HANDLING PART 2
Q 12 Following is the structure of each record in a data file named
“Colony.dat”
struct Colony
{
char colony_code[10];
char colony_name[10];
int no_of_people;
};
Wite
a function to update the file with a new value of No_of_people. The value of
colony_code and no_of_people are read
during the execution of the program.
Q 13 Assuming the
class ZOO given below, write functions in C++ to perform following:
i.
Write the objects of ZOO to a binary file.
ii.
Read the objects of ZOO from binary file and display
them on screen.
class ZOO
{
char
location[20];
int
no_of_animals[10];
public:
void
readdata()
{
cin>>location;
gets(no_of_animals);
}
void
writedata()
{
cout<
}
};
No comments:
Post a Comment