Question: it is C++ I need to modify this code // array of structures #include #include #include using namespace std; struct movies_t { string title; int
it is C++
I need to modify this code
// array of structures #include#include #include using namespace std; struct movies_t { string title; int year; } films [3]; void printmovie (movies_t movie); int main () { string mystr; int n; for (n=0; n<3; n++) { cout << "Enter title: "; getline (cin,films[n].title); cout << "Enter year: "; getline (cin,mystr); stringstream(mystr) >> films[n].year; } cout << " You have entered these movies: "; for (n=0; n<3; n++) printmovie (films[n]); return 0; } void printmovie (movies_t movie) { cout << movie.title; cout << " (" << movie.year << ") "; }
The output is
Enter title: Blade Runner Enter year: 1982 Enter title: The Matrix Enter year: 1999 Enter title: Taxi Driver Enter year: 1976 You have entered these movies: Blade Runner (1982) The Matrix (1999) Taxi Driver (1976)
THE MODIFICATIONs SHOULD BE:
1. Instead of movie titles in the data structure, use US state names.
2. Instead of release dates in the data structure, use the populations
3. You will add different output line that says:
"The most populous state you entered is:"
EXAMPLE OF INPUTS AND OUTPUTS
Enter state Georgia Enter population: 10545138 Enter state: Ohio Enter population: 11694664 Enter state: California Enter population: 39776830 The most populous state you entered is: California.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
