im working on a program who the user enters data of a Movie: name, Director, and playtime im on my last error but i cant see the where the problem is ore what to do i trayed to change some parts in the code to see the problem with no luck.
#include "stdafx.h"
#include "cstdlib"
#include "iostream"
#include "iomanip"
#include "string"
#include "list"
#include "sstream"
#include "stdlib.h"
using namespace std;
struct dvd {
string name;
string director;
string playtime;
};
void movie(list<string> lista);
void director(list<string> lista);
void playtime(list<string> lista);
void write(list<string> lista);
int main(int argc, char *argv[])
{
list<string> lista;
list<string>::iterator it = lista.begin();
for (int i=1; i<=2; it++){
it++;
}
dvd movie;
movie(lista);
lista.insert (it,movie.name);
director(lista);
lista.insert (it,movie.director);
playtime(lista);
lista.insert (it,movie.playtime);
write(lista);
lista.clear();
write(lista);
return 0;
}
void movie(list<string> lista)
{
dvd movie;
string M;
cout << "Movie: ";
getline(cin, movie.name);
lista.push_back(movie.name);
}
void director(list<string> lista)
{
dvd movie;
cout << "Director: ";
getline(cin, movie.director);
lista.push_back(movie.director);
}
void playtime(list<string> lista)
{
dvd movie;
cout << "Playtime: ";
cin >> movie.playtime;
cin.ignore(1000, '\n');
}
void write(list<string> lista)
{
cout << "\nResult: \n";
list<string>::iterator it;
for (it = lista.begin(); it != lista.end(); it++){
cout << *it << endl;
}
}