I created a class where I am defining member variables of string and integer data types.
When the function is called for a new object, I type in the string value, press Enter, and all the variables left are given some default value, and my program ends.
I do not know how to stop it from just ending, and letting me type each string value.
Here is a copy of my code:
#include <iostream>     //Header file needed to do inputs and outputs
#include <iomanip>      //Header file needed to use setw
#include <math.h>       //Header file needed to use power function
using namespace std;
class MovieData
{
    private:
        string title, director;
        int year, runTime;
    public:
        void setInfo()
        {  
            cout << "Movie title: ";
            cin >> title;
            cout << "Diector: ";
            cin >> director;
            cout << "Year: ";
            cin >> year;
            cout << "Runnign Time: ";
            runTime;
        }
        void displayInfo ()
        {
            cout << "Movie title " << title << endl;
            cout << "Director " << director << endl;
            cout << "Year " << year << endl;
            cout << "Run Time " << runTime << endl;
        }
};
int main() {
    MovieData movie1, movie2;
    movie1.setInfo();
    movie2.setInfo();
    movie1.displayInfo();
    movie2.displayInfo();
    return 0;
}
I tried defining string variables as c-string, so character arrays, to see if that would help the issue, but it is the same.

 
     
     
    