I'm pushing my knowledge on this program and so far so good but I came across 2 errors. Program Calculates the area of a rectangle or triangle, or the volume of a pyramid or cube.
The first error says there are two things wrong with it and says:
Error 1 error C2451: conditional expression of type 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' is illegal c:\users\cody\documents\visual studio 2013\projects\areavolumecalc\source.cpp 19 1 AreaVolumeCalc
2 IntelliSense: expression must have bool type (or be convertible to bool) c:\Users\Cody\Documents\Visual Studio 2013\Projects\AreaVolumeCalc\Source.cpp 19 6 AreaVolumeCalc
int main()
{
//Get area or volume
string areaVolume = "";
cout << "Are you trying to find the area or volume?\n";
cin >> areaVolume;
//If area, ask rectangle or triangle
if (areaVolume = "area")
{
string shapeArea = "";
cout << "What shape is it? (Rectangle or Triangle)\n";
cin >> shapeArea;
//If rectangle ask for 2 values
if (shapeArea == "rectangle")
{
double baseRectangle = 0;
cout << "What is the base length?\n";
cin >> baseRectangle;
double heightRectangle = 0;
cout << "What is the height?\n";
cin >> heightRectangle;
//Multiple 2 values together
double rectangleProduct = (double)(baseRectangle * heightRectangle);
And then the other problem I am having is here with this error, I don't know the correct way to do the cube root of a number:
3 IntelliSense: expression must have integral or unscoped enum type c:\Users\Cody\Documents\Visual Studio 2013\Projects\AreaVolumeCalc\Source.cpp 108 25 AreaVolumeCalc
1 2 3 4 5 6 7 8 9
else
{
double baseCube = 0;
cout << "What is the base length?\n";
cin >> baseCube;
//multiply base^3
double cubeProduct = baseCube ^ 3;