Need help with this in C++. I got the Movie part, but I need help with the release dates
There is a file of Warner Brothers movies on the
internet. Each entry has the following form: Name of Movie Release
Date Several names of the stars in the movie A separator line which
is blank Your assignment is: for each movie, 1. read in the Name,
Release Date and stars 2. Sort the movies by Movie Name
alphabetically, 3. Sort the stars alphabetically by last name, 4.
Print the Movie Name, Release Date, and Print the list of stars
(alphabetically by last name).
Click here to see the Input File Some Sample Output: The Lucky
One April 20, 2012 Joe Chrest Blythe Danner Zac Efron Jay R.
Ferguson Robert Hayes Adam LeFevre Taylor Schilling Riley Thomas
Stewart
Code implemented in c++
used structure to store name,release_date,stars
implement as mentioned above
#include<bits/stdc++.h>
using namespace std;
struct movie{
string name;
string releasedate;
vector<pair<string,string> >
l;
};
bool comp(movie a,movie b){
return a.name<b.name;
}
bool sortbysec(const pair<string,string> &a, const
pair<string,string> &b)
{
return (a.second < b.second);
}
int main(){
ifstream fin;
string lin;
string line;
vector<string>data;
vector<movie> movielist;
fin.open("movielist.txt");
movie m;
while (fin){
getline(fin,
line);
data.push_back(line);
}
fin.close();
int f1=0,f2=0;
for(int i=0;i<data.size();i++){
if(data[i].length()==0){
f1=0;f2=0;
sort(m.l.begin(),m.l.end(),sortbysec);
movielist.push_back(m);
m.l.clear();
}
if(f1&&f2){
vector<string>out;
istringstream
ss(data[i]);
do {
ss >> line;
out.push_back(line);
} while
(ss);
string
second;
for(int
j=1;j<out.size()-1;j++){
second+=out[j]+" ";
}
m.l.push_back(make_pair(out[0],second);
}
if(f1==1&&f2==0){
m.releasedate=data[i];
f2=1;
}
if(data[i].length()&&f1==0){
m.name=data[i];
f1=1;
}
}
sort(movielist.begin(),movielist.end(),comp);
for(int i=0;i<movielist.size();i++){
cout<<movielist[i].name<<endl;
cout<<movielist[i].releasedate<<endl;
for(int
j=0;j<movielist[i].l.size();j++){
cout<<movielist[i].l[j].first<<"
"<<movielist[i].l[j].second<<endl;
}
cout<<endl;
}
}


movielist.txt
Journey 2: The Mysterious Island
February 10, 2012
Josh Hutcherson
Dwayne Johnson
Michael Caine
Project X
March 2, 2012
Thomas Mann
Oliver Cooper
Jonathan Daniel Brown
Wrath of the Titans
March 30, 2012
Sam Worthington
Liam Neeson
Rosamund Pike
The Lucky One
April 20, 2012
Zac Efron
Taylor Schilling
Blythe Danner
Riley Thomas Stewart
JayR. Ferguson
Adam LeFevre
Robert Hayes
Joe Chrest
Dark Shadows
May 11, 2012
Johnny Depp
Michelle Pfeiffer
Eva Green
Chernobyl Diaries
May 25, 2012
Jesse McCartney
Jonathan Sadowski
Olivia Dudley
Rock of Ages
June 15, 2012
Julianne Hough
Diego Boneta
Tom Cruise
Magic Mike
June 29, 2012
Channing Tatum
Alex Pettyfer
Olivia Munn
The Dark Knight Rises
July 20, 2012
Christian Bale
Tom Hardy
Anne Hathaway
The Campaign
August 10, 2012
Will Ferrell
Zach Galifianakis
Jason Sudeikis
Dylan McDermott
Katherine LaNasa
Sarah Baker
John Lithgow
Dan Aykroyd
Brian Cox
Need help with this in C++. I got the Movie part, but I need help with...
Need help with this C++ assignment, please use comments so I can better understand your code like comments above your function header explaining what the function does and the purpose of each variable. etc. Assignment: Write a C++ program that reads a text file containing a list of movies "Movie_entries.txt" . Each line in the file contains tile, director, genre, year released and running time of a specific movie. Each field is separated by comma. Print out movie titles sorted...
Need this in C++ Goals: Your task is to implement a binary search tree of linked lists of movies. Tree nodes will contain a letter of the alphabet and a linked list. The linked list will be an alphabetically sorted list of movies which start with that letter. MovieTree() ➔ Constructor: Initialize any member variables of the class to default ~MovieTree() ➔ Destructor: Free all memory that was allocated void printMovieInventory() ➔ Print every movie in the data structure in...
I need help for part B and C
1) Create a new project in NetBeans called Lab6Inheritance. Add a new Java class to the project called Person. 2) The UML class diagram for Person is as follows: Person - name: String - id: int + Person( String name, int id) + getName(): String + getido: int + display(): void 3) Add fields to Person class. 4) Add the constructor and the getters to person class. 5) Add the display() method,...
Need help with C++ assignment
Assignment 1 and .txt files are provided at the
bottom.
PART A
PART B
Assignment
1
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <algorithm>
using namespace std;
/**
This structure is to store the date and it has three integer
fields
**/
struct Date{
int day;
int month;
int year;
};
/**
This structure is to store the size of the box and it...
Here is the database file: -------------------------moviedatabase.sql------------------------- INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (1,'Idrissa Akuna ','Elba','4706091972','Actor','1972-09-06 00:00:00','CA'); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (2,'Christopher Hemsworth','Hemsworth','3408111983','Actor','1983-08-11 00:00:00','IL'); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (3,'Zoe ','Saldana','4106191978','Actor','1978-06-19 00:00:00','AZ'); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (4,'Christopher','Townsend','3903251976','Visual Effects','1976-03-25 00:00:00',NULL); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (5,'Guy','Williams','3209211985','Reviewer','1985-09-21 00:00:00',NULL); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (6,'Jonathan','Fawkner','3011131990','Reviewer','1990-11-13 00:00:00',NULL); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (7,'Dan','Sudick','4701201972','Visual Effects','1972-01-20 00:00:00','NJ'); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (8,'Tom','Holland','2401061996','Actor','1996-06-01 00:00:00','CA'); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth...
i need help with a mips program to to covert roman numerals to
real numbers
Lab 4: Roman Numeral Conversion Part A: Due Sunday, 19 May 2019, 11:59 PM Due Friday, 24 May 2019, 11:59 PM Part B: Minimum Submission Requirements Ensure that your Lab4 folder contains the following files (note the capitalization convention): o Diagram.pdf o Lab4. asm O README.txt Commit and push your repository Lab Objective In this lab, you will develop a more detailed understanding of how...