>>I forgot how to make it so when i type something and press enter, it displays what i wanted it to.
use cin to get keyboard input
int price;
cout << "Enter price of house\n";
cin >> price;
cout << "The price you entered is " << price << "\n";
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
The reason it closes is because cin left the Enter key '\n' in the keyboard buffer, and the next cin.get() just removed it. To fix this problem you need to flush the keyboard buffer after entering numeric data. One way to do that is call ignore(). See Narue's article in the c++ forum stick post about details of how to flush the input keyboard buffer.
cin >> price;
cin.ignore(); // flush '\n'
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343