Question: Please help make this compile, I've already wasted about 5 questions on this. Following error shows up when compiling: lab07.cpp: In function 'int main()': lab07.cpp:24:22:

Please help make this compile, I've already wasted about 5 questions on this.

Following error shows up when compiling:

lab07.cpp: In function 'int main()': lab07.cpp:24:22: error: 'stoi' was not declared in this scope year = stoi(yr); ^

My code:

#include #include #include using namespace std;

int main() { string movie_name, movie_snack, mov_snk, filename, yr; int year; ifstream dataIn; cout << "What is the name of the file?" << endl; cin >> filename; dataIn.open(filename.c_str());

if (dataIn.fail()) { cout << "** Invalid Filename **" << endl; } else { getline(dataIn, movie_name); getline(dataIn, yr); getline(dataIn, mov_snk); year = stoi(yr); movie_snack = mov_snk; dataIn.close(); cout << "Movie title: " << movie_name << endl; cout << "The movie will be 100 years old in " << year+100 << endl; cout << "Movie snack: " << movie_snack << endl; }

return 0; }

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!