#include <iostream>
#include <string.h>
#include <string>
#include<fstream>
struct time
{
int hours, minutes;
};
struct moviedata
{
string moviename, genre, actorname1, actorname2;
int yearreleased, priceperday;
time duration;
};
void readmoviedata(moviedata *ptr) /*not ale to run this code*/
{
int i = 0;
string x;
ifstream inside("movies.txt");
while (!inside.eof())
{
getline(inside, ptr[i].moviename);
inside >> ptr[i].yearreleased;
getline(inside, ptr[i].genre);
inside >> ptr[i].duration.hours;
inside >> ptr[i].duration.minutes;
getline(inside, ptr[i].actorname1);
getline(inside, ptr[i].actorname2);
inside >> ptr[i].yearreleased;
i++;
}
}
int main()
{
moviedata *md = new moviedata;
readmoviedata(md);
delete md;
return 0;
}
can anyone tell me what i did wrong with function readmoviedata $ when runned line by line as soon as the function readmoviedata is called $ black grid appears with cursor blinking and nothin else