输入cin>>后,我在Visual Studios中执行此代码在完成之前,tomatometer将程序退出。任何帮助将不胜感激?
#include <iostream>
#include <string>
using namespace std;
int main() {
// Get the name of the Movie
string movie = "";
cout << "What is the name if the movie ?\n";
getline(cin, movie);
// Get the Metascore
double metascore = 0;
cout << "What is the Metascore rating " << movie << " ?\n";
cin >> metascore;
// Get the Tomatometer score
double tomatometer = 0;
cout << "What is the Tomatoscore rating " << movie << "?\n";
cin >> tomatometer;
// Calculate the average
double avg = (metascore + tomatometer) / 2.0;
// Rescale the average
double rescaleScore = avg / 10;
cout << "Our average rating on a 10 point scale for " << movie
<< " is " << rescaleScore
<< "."; // Display the results of the calculation
return 0;
}