Please help solve these structure in c I haave copied and pa

Please help solve these structure in c++ I haave copied and pasted the instructions and examples::

{
string movieTitle; //name of movie
unsigned int numberCopies; //number of copies
string videoType; //type of video
Video() // Constructor
{
movieTitle =

Solution

// writing into a binary file
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

struct Video
{
string MovieTitle; //name of movie
unsigned int numberCopies; //number of copies
string videoType; //type of video
Video() // Constructor
{
MovieTitle = \"NA\";
numberCopies = 0;
videoType = \"NA\";
}
};
void display(Video *v, int size)
{
cout<<\"Movie\\tCopy\\tType\ \";
for(int i=0;i<size;i++) cout<<v[0].MovieTitle<<\"\\t\"<<v[0].numberCopies<<\"\\t\"<<v[0].videoType<<endl;
}
int main () {

Video v[100];
int size=0;
fstream file(\"example.bin\", ios::in|ios::binary);
//writeFile(file,\"example.bin\", vd);
if (!file.fail())
{
while(file.good())
{
file.read(v+size, sizeof(Video));
size++;
}
file.close();
}
display(v,size);

}


Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site