새내기는 여기에 있습니다. 나는 다음이 : 나는하지 않고 콘솔을 종료하기 위해 노력하고있어어떻게 콘솔을 종료 할 수 있습니까?
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<stdlib.h>
using namespace std;
int main() {
int choice;
double radius, length, width, base, height;
const double PI = 3.14159;
cout << ":Geometry Calculator:\n\n";
cout << "1. Calculate the Area of a Circle \n";
cout << "2. Calculate the Area of a Rectangle \n";
cout << "3. Calculate the Area of a Triangle \n";
cout << "4. Quit\n";
cout << "4. Please pick number: " ;
cin >> choice;
switch (choice) {
case 1:
double aCirc;
cout << "Enter the RADIUS of your Circle: ";
cin >> radius;
aCirc = PI * pow(radius, 2);
cout << "The AREA of your CIRCLE IS: " << aCirc;
break;
case 2:
double aRec;
cout << "Enter the LENGTH and WIDTH of your Rectangle (seprate your numbers with a space): ";
cin >> length >> width;
aRec = length * width;
cout << "The AREA of your Rectangle is: " << aRec;
break;
case 3:
double aTri;
cout << "Enter the BASE and HEIGHT of your Triangle (separate your numbers with a space): ";
cin >> base >> height;
aTri = (base * height)/2;
break;
case 4:
exit();
default:
cout << "\n You entered an Invalid Number GoodBye No Number" << endl;
}
return 0;
}
바로 내가 다른 가능한 기능 그러나 나는 내가이 정확하다고 생각, 잘못을 활용하고있어 믿고 검색 "4"사용자 프레스 후, 나는 다른 사이트에서 그것을 보았다 그러나 그것은 작동하지 않았다, 아무도 도울 수 있습니까 ?? 시간과 전문 지식에 감사드립니다.
사용자가 "4"를 누르면 프로그램이 종료되고 "4"와 "돌아 가기"를 누르는 것이 아닙니까? –
네, 맞습니다. 혼란에 빠져서 죄송합니다. –