初心者はこちらです。私は以下の持っている:私はせずにコンソールを終了しようとしているコンソールを終了するにはどうしたらいいですか?
#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」と「戻る」を押したときではありませんか? –
はい、そうです、混乱して申し訳ありません。 –