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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started