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 alphabetically.
Avengers: Age of Ultron,Joss Whedon,science fiction,2015,120
Mean Girls,Mark Waters,comedy,2004,97
Happy Feet,George Miller,comedy,2006,108
Surf's Up,Chris Buck,adventure,2007,85
The Great Escape,John Sturges,thriller,1963,172
Superbad,Gret Mottola,comedy,2007,113
Earthlings,Shaun Monson,documentary,2005,95
Limitless,Neil Burger,thriller,2011,105
Guardians of the Galaxy,James Gunn,fantasy,2014,120
Kung Fu Hustle,Stephen Chow,fantasy,2004,99
Whiplash,Damien Chazelle,drama,2014,106
Ghost in the Shell,Mamoru Oshii,manga,1995,82
Inglourious Basterds,Quentin Tarantino,drama,2009,120
Under the Tuscan Sun,Audrey Wells,drama,2003,113
A Thousand Words,Brian Robbins,comedy,2012,91
Interstellar,Christopher Nollan,science fiction,2014,160
Zoolander,Ben Stiller,comedy,2001,105
Captain America: The Winter Soldier,Russo,science fiction,2014,120
Chungking Express,Kai Wai Wong,drama,1994,98
The Matrix,Andy Wachowski,fantasy,1999,136
Gone Girl,David Fincher,mystery,2014,129
Saving Private Ryan,Steven Spielberg,drama,1998,120
Detailed specifications:
#include<iostream>
#include<vector> //for vector
#include<algorithm> //for sort
#include<fstream> //for ifstream
#include<sstream> //for stringstream
using namespace std;
void Print_Name(vector<string> x){ //will print the movie
name
for(auto i : x){
cout<<i<<"\n";
}
}
int main(){
vector <string> Movie_Name; //storing
movie name in vector
ifstream fin; //file pointer
string line,title; //strings for line and movie title
fin.open("Movie_entries.txt"); //will try to
open file at default path
if(fin.is_open()){
//if file open procced
further
}
else{ //if file not opened
cout<<"Can't open
file\n Enter the different path:";
while(true){
string File_Path; //will store the file path
getline(cin,File_Path); //will get the path from user through
keyboard and store into File_Path
fin.open(File_Path.c_str()); //will open the
file
if(fin.is_open())
break;
}
}
cout<<"File open successfully !!!";
while(getline(fin,line)){
stringstream
linestream(line);
getline(linestream,title,','); //separates the title
Movie_Name.push_back(title); //store the title in
vector Movie_Name
}
fin.close(); //will close the
file
sort(Movie_Name.begin(),Movie_Name.end());
//will sort the title alphabetically
Print_Name(Movie_Name); //calling print function
return 0;
}
Need help with this C++ assignment, please use comments so I can better understand your code...
Using an object-oriented approach, write a program to read a file containing movie data (Tile, Director, Genre, Year Released, Running Time) into a vector of structures and perform the following operations: Search for a specific title Search for movies by a specific director Search for movies by a specific genre Search for movies released in a certain time period Search for movies within a range for running time Display the movies on the screen in a nice, easy to read...
please use C++ write a program to read a textfile containing a list of books. each line in the file has tile, ... Question: Write a program to read a textfile containing a list of books. each line in the file has tile, ..... write a program to read a textfile containing a list of books. each line in the file has tile, ... Question: Write a program to read a textfile containing a list of books. Each line in...
MUST BE WRITTEN IN C++ Objective: Learn how to define structures and classes, create and access a vector of structures, use sort with different compare functions. Assignment: Your program will use the same input file, but you will print the whole book information, not just the title. And, most importantly, this time you will take an object oriented approach to this problem. Detailed specifications: Define a class named Collection, in which you will define a structure that can hold book...
MUST BE WRITTEN IN C++ Objective: Learn how to define structures and classes, create and access a vector of structures, use sort with different compare functions. Assignment: Your program will use the same input file, but you will print the whole book information, not just the title. And, most importantly, this time you will take an object oriented approach to this problem. Detailed specifications: Define a class named Collection, in which you will define a structure that can hold book...
[C++]
Outline:
The movie data is read from a file into an array of structs and
is sorted using the Selection Sort method and the search is done
using the Binary Search algorithm with the year of release as key.
This assignment upgrades to an array of pointers to the database
elements and converts the Selection Sort and Binary search
procedure on the database to selection sort and binary search on
the array of pointers to the database.
Requirements:
Your...
Hi i need Help. i use MYSQL command line.
THE QUESTION ARE BELOW
please check the answer before you submit because sometimes
query gives error thank you
For Full database of SQL you can DOWNLOAD from this link:
https://drive.google.com/file/d/1xh1TcBfMtvKoxvJr7Csgnts68fF53Q1t/view?usp=sharing
-------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
What are the total sales for each year. Note that you will need
to use the YEAR function. Order by year with the newest year
first.
-------------------------------------------------------
How many employees have no customers?
------------------------------------------------------------------
List the total sales for...
I need an OUTLINE ONLY (pseudocode/comments). DO NOT DO THE PROGRAMMING ASSIGNMENT. Part I: PA3 Outline (10 points). Create an outline in comments/psuedocode for the programming assignment below. Place your comments in the appropriate files: main.cpp, functions.h, dealer.cpp, dealer.h, dealer.cpp (as noted below). Place into a file folder named LastnamePA3, the zip the content and hand in a zip file to Canvas. Part II: PA3: Car Dealership (40 points) For Programming Assignment 3 you will be creating a program to...
PLEASE COMPLETE THE CODES. package javaprogram; import java.io.PrintStream; import java.util.ArrayList; import java.util.Scanner; /** * Movie class definition. * * @author David Brown * @version 2019-01-22 */ public class Movie implements Comparable { // Constants public static final int FIRST_YEAR = 1888; public static final String[] GENRES = { "science fiction", "fantasy", "drama", "romance", "comedy", "zombie", "action", "historical", "horror", "war" }; public static final int MAX_RATING = 10; public static final int MIN_RATING = 0; /** * Converts a string of...
Need help with this Matlab program %% Exercise 1 % NOTE: Please suppress output--i.e., use a semicolon ';' at the end of any % commands for which the output is not necessary to answer the question. % Delete these notes before turning in. % Define input variable theta as discretized row vector (i.e., array). theta = ??; % Define radius. r = ??; % Define x and y in terms of theta and r. x = ??; y = ??;...
Using C++ Skills Required Create and use classes Exception Handling, Read and write files, work vectors. Create Functions, include headers and other files, Loops(while, for), conditional(if, switch), datatypes, etc. Assignment You work at the computer science library, and your boss just bought a bunch of new books for the library! All of the new books need to be cataloged and sorted back on the shelf. You don’t need to keep track of which customer has the book or not, just whether...