Question: #include #include #include #include #include #include using namespace std; //Function prototype void print(vector ); int main() { //Creste file read object ifstream in(C:/Users/Hao/Desktop/moviesl.txt); //Check file

#include #include #include #include #include #include using namespace std; //Function prototype void print(vector); int main() { //Creste file read object ifstream in("C:/Users/Hao/Desktop/moviesl.txt"); //Check file present or not //Otherwise prompt for user string fName; //Check file exist while (!in) { cout << "File not open!!Try again" << endl; cout << "Enter file name: "; cin >> fName; in.open(fName); } //Variables for file operation string line; string title; //Store titles vector vector titles; //Loop until end of the file while (!in.eof()) { //Read line by line getline(in, line); //stream object stringstream ss(line); //Get title of the movie getline(ss, title, ','); //Push into vector titles.push_back(title); } //Sort alphabetically sort(titles.begin(), titles.end()); ///Call method to print print(titles); } //Function to print movie titles void print(vector titles) { for(int i=0;i

123.cpp x #include #include #include 3 #include #include #include using namespace std; //Function prototype void print (vector); int main () 10 11 Creste file read object 12 ifstream in ("C:/Users/Hag/Desktop/moviesl.txt"): 13 //Check file present or not 14 //Otherwise prompt for user 15 string fName; //Check file exist 16 17 while (!in) { 18 19 cout << "File not open!!Try again" << endl; cout << "Enter file name: 20 "; 21 cin >> fName; in.open (fName) ; 22 23 //Variables for file operation 24 string line; string title; 25 26 //Store titles vector 27 28 vector titles; 29 //Loop until end of the file Awhile (!in.eof ()) { 30 //Read line by line getline (in, line); 31 32 //stream object 33 stringstream ss (line): 34 ogs & others A CppCheck/Vera++ x A CppCheck/Vera++ messages 1A Code::Blocks O Search results * Build messages x A Ccc Build log XA Csc File Line Message === Build file: "no target" in "no project" (compiler: unknown) === In function 'int main ()': C:\Users\Hao\D... error: no matching function for call to 'std::basic_ifstream::open (std::_cxxll:... _Traits>::open (const char*, std::ios... C:\Users\Hao\D... 22 C:\Program Fil... 595 note: candidate: void std::basic_ifstream_CharT, no known conversion for argument 1 from 'std::_cxxll::string {aka std:: C:\Program Fil... 595 cxxl... note Windows (CR+LF) Line 22, Col 1, Pos 479 Read/Write default C/C++ WINDOWS-936 Insert

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!