Программа перестает отвечать после ввода диаметра [закрыто] ⇐ C++
-
Anonymous
Программа перестает отвечать после ввода диаметра [закрыто]
I'm working on a program for a class. The prompt is "Write a program that asks the user their name and the diameter or the pizza they want, calculate the area of the pizza using PI to four decimal places (3.1415) but show the area of their Pizza to the user to two decimal places by using setprecision and fixed from chapter 3 on the output." The issue I'm running into is that once the diameter is input by the user, the program no longer responds.
#include #include #include using namespace std; int main() { string firstName; double Diameter, Area; const double Pi = 3.1415; cout > firstName; cout > Diameter; double Radius = Diameter / 2; cout > Area; Area = Pi * Radius * Radius; cout
Источник: https://stackoverflow.com/questions/781 ... r-is-input
I'm working on a program for a class. The prompt is "Write a program that asks the user their name and the diameter or the pizza they want, calculate the area of the pizza using PI to four decimal places (3.1415) but show the area of their Pizza to the user to two decimal places by using setprecision and fixed from chapter 3 on the output." The issue I'm running into is that once the diameter is input by the user, the program no longer responds.
#include #include #include using namespace std; int main() { string firstName; double Diameter, Area; const double Pi = 3.1415; cout > firstName; cout > Diameter; double Radius = Diameter / 2; cout > Area; Area = Pi * Radius * Radius; cout
Источник: https://stackoverflow.com/questions/781 ... r-is-input
Мобильная версия