I have a project assignment for school... Basically its coming up with a Windows console C++ .EXE well i have spent a few hours developing a Geometry Calculator.. WOuld anyone be willing to test and report some bugs to me??

This is the project download link:

https://sourceforge.net/projects/geocalcrobertdu/

People also wanted me to post the code to it

math.h

#ifndef MATH_H_INCLUDED
#define MATH_H_INCLUDED

namespace geomath{


class shape {

public:
    void setFunction();
    void setShape();
    void calcShape();
    void calcCircle();
    void calcRightTriangle();
    void calcEqualTrianle();
    void calcCylinder();
    void setShapeV();
    void calcCylinderV();
    void calcSphereV();

private:
    float rad;
    float height;
    float width;
    float total;
    int option;
    float Base;
    float Height;
    float knownside;
    float Rad;
    float H;
    int foption;
    int voption;
    float radbasev;
    float heightCV;
    float sradius;

};

}

#endif 

Geocalc.cpp

#include "stdafx.h"
#include <iostream>
#include "stdlib.h"
#include "math.h"
using namespace std;

namespace geomath{

    void shape::setFunction(){

        cout << "Welcome To the Welcome screen" << endl << endl;
        cout << "Choose from the following options: " << endl;
        cout << "1. Find Area" << endl;
        cout << "2. Find Volume" << endl;
        cin >> foption;
        if(foption == 1){

            setShape();

        }

        if(foption == 2){

            setShapeV();

        }

    }


    void shape::setShapeV(){

    cout << "Loading(Math equations)....." << endl;
    cout << "Loading(shapes)......." << endl;
    cout << "done!" << endl << endl;

    cout << "welcome to GeoCALC(Volume)" << endl;

    cout << "Choose a shape you want to find an area of: " << endl;
    cout << "1. Cylinder" << endl;
    cout << "2. Sphere" << endl;
    cin >> voption; 

    if(voption == 1){

        calcCylinderV();

    }
    if(voption == 2){

    calcSphereV();

    }

    }

    void shape::setShape(){

    cout << "Loading(Math equations)....." << endl;
    cout << "Loading(shapes)......." << endl;
    cout << "done!" << endl << endl;

    cout << "welcome to GeoCALC(Areas)" << endl;

    cout << "Choose a shape you want to find an area of: " << endl;
    cout << "1. Rectangle" << endl;
    cout << "2. Circle" << endl;
    cout << "3. Right Triangle" << endl;
    cout << "4. Equal Triangle" << endl;
    cout << "5. Cylinder" << endl;


    cin >> option;

    if(option == 1){


calcShape();                    

}

    if(option == 2){


    calcCircle();
}

    if(option == 3){

        calcRightTriangle();

    }

    if(option == 4){

     calcEqualTrianle();

    }

    if(option == 5){

    calcCylinder();

    }


}





    void shape::calcSphereV(){

        cout << "Enter the radius of your sphere: " << endl;
        cin >> sradius;
        float eq8a = 1.33333333;
        float eq8b = 3.14;
        float eq8c = sradius * sradius * sradius;
        float eq = eq8a *  eq8b * eq8c;
        cout << eq;

    }


    void shape::calcCylinderV(){



        cout << "Please enter the radius of the base: " << endl;
        cin >> radbasev;

        cout << "Please enter the height of the cylinder: " << endl;
        cin >> heightCV;

        float area = 3.14 * radbasev * radbasev;
        float eqt = area * heightCV;

        cout << eqt << endl;
        cout << "REMEMBER THIS IS A VOLUME UNIT SO ITS WHATEVER CUBED" << endl;
    }

    void shape::calcShape(){

    cout << "Please enter the height and width of your rectangle" << endl;

    cin >> height;

    cin >> width;

    int eq = width * height;



    cout << eq << endl;

}

void shape::calcRightTriangle(){

    cout << "Enter the Base and the height of the triangle: " << endl;
    cin >> Height;
    cin >> Base;
    float eq2 = (Height * Base) / 2;
    cout << eq2 << endl;
}

void shape::calcEqualTrianle(){

    cout << "Enter 1 known side of your Triangle: " << endl;
    cin >> knownside;
    float three = 3;
    float eq3a = sqrt(three) / 4;
    float eq3 = (eq3a * knownside * knownside);
    cout << eq3 << endl;
}
void shape::calcCylinder(){

    cout << "Enter the radius of your cylinder: " << endl;
    cin >> Rad;
    cout << "Enter the height of your cylinder: " << endl;
    cin >> H;
    float eq5a = 2 * 3.14 * Rad*Rad;
    float eq5b = 2 * 3.14 * Rad;
    float eq5 = eq5a + eq5b * H;
    cout << eq5 << endl;
}

void shape::calcCircle(){



    cout << "Enter the radius of your circle(1/2 of your diamerter)" << endl;

    cin >> rad;

    float eq1 = 3.14 * (rad * rad);

    cout << eq1 << endl;


}
}
int main(){
    char cDo;
    do{
    system("CLS");
    geomath::shape * pad=new(geomath::shape);

    pad->setFunction();

    //pad->calcShape();

    //pad->calcCircle();


cout << "Would you like to continue Y/N" <<endl;
 cin >> cDo;
    }while (cDo == 'Y' || cDo == 'y');


    system("pause");


    return 0;


}

Edited 3 Years Ago by Nick Evan: Fixed formatting

You're not likely to get anyone to run an unknown executable. Provide the code so that we can compile and run it after determining that it's safe and you'll get better responses.

When you are giving people code and you want them to read it you should make sure your formatting is consistent. Some of your {} are to the far left when they should be tabbed in once because it makes it harder to see what is going on with the code when you can hardly read it.

Anyways your program seems to work fine other than the fact that it always says you entered an invalid option unless you select 5. This is because you have a bunch of if statements in series when you should have an if followed by else if's or just a switch statement.

switch (option)
{
	case 1:
		calcShape();
		break;
	case 2:
		calcCircle();
		break;
	case 3:
		calcRightTriangle();
		break;
	case 4:
		calcEqualTrianle();
		break;
	case 5:
		calcCylinder();
		break;
	default:
		cout << "That is not a valid operation geocalc will now close" << endl;
		break;
}
This article has been dead for over six months. Start a new discussion instead.