다른 모양의 영역 및 부피를 계산하는 할당 수행. 붙어 다니는 것은 삼가면서 말하는 것입니다. 'showMenu'를 요청하는 오류를 가져옵니다. 함수는 0 인수를 취하지 않습니다. & 또한 함수 호출 오류가 너무 적습니다. 이 문제를 해결하는 방법에 대한 모든 포인터?함수 호출 오류가 너무 적음
#include <iostream>
#include <iomanip>
using namespace std;
//Functions
void showMenu(int &);
double area (double, double);
double area (double);
double volume (double, double, double);
double volume (double);
const double PI = 3.14;
int main()
{
int choice;
double area, volume, length, width, radius, height;
const double PI = 3.14;
do
{
showMenu();
cin >> choice;
if (choice < 1 || choice > 5)
{
cout << "Please select a valid choice of 1-5: " << endl;
cin >> choice;
}
else if (choice == 1)
{
double tarea(area);
cout << "Enter the length: ";
cin >> length;
cout << "Enter the width: ";
cin >> width;
cout << "The area of the rectangle is: " << tarea << endl;
}
else if (choice == 2)
{
double tarea(area);
cout << "Enter the radius: ";
cin >> radius;
cout << "The area of the circle is: " << tarea << endl;
}
else if (choice == 3)
{
double tvolume (volume);
cout << "Enter the length: ";
cin >> length;
cout << "Enter the width: ";
cin >> width;
cout << "Enter the height: ";
cin >> height;
cout << "The volume for a box is: " << tvolume << endl;
}
else if (choice == 4)
{
double tvolume (volume);
cout << "Enter the radius: ";
cin >> radius;
cout << "The volume of a sphere is: " << endl;
}
}
while (choice != 5);
return 0;
}
void ShowMenu(int &choice)
{
cout << "1. Calculate the area of a rectangle";
cout << "2. Calculate the area of a circle";
cout << "3. Calculate the volume for a box";
cout << "4. Calculate the volume of a sphere";
cout << "5. Quit";
}
double area (double length, double width)
{
double tarea = length * width;
return tarea;
}
double area (double radius)
{
double tarea = PI * (radius * radius);
return tarea;
}
double volume (double length, double width, double height)
{
double tvolume = length * width * height;
return tvolume;
}
double volume (double radius)
{
double tvolume = (4/3) * PI * (radius * radius * radius);
return tvolume;
}
매개 변수를 사용하거나 사용하지 않으므로 매개 변수를 꺼내시겠습니까? – chris