Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
14 kB
1
Indexable
Never
#include <iostream>
#include <string>
#include <cmath>
using namespace std;

void startProgram();

void firstSelect(char);

void geometrySelect(char);

void triangleSelect(char);

void rightTriangleSelect(char);

void equilateralTriangleSelect(char);

void differentSideTriangleSelect(char);

void circleOnATriangleSelect(char);

void circleInATriangleSelect(char);

void circularSelect(char);

void circularLengthSelect(char);

void circularAreaSelect(char);

void polygonsSelect(char);

void parallelogramSelect(char);

void trapezoidSelect(char);

void rhombusSelect(char);

void rectangleSelect(char);

void squareSelect(char);

void arithmeticSelect(char);

void measurementUnitsConverterSelect(char);

void weightMeasurementUnitsSelect(char);

void lenghtMeasurementUnitsSelect(char);

void volumeMeasurementUnitsSelect(char);

void timeMeasurementUnitsSelect(char);

void equationSelect(char);

void mathematicalOperationsSelect(char);

class Triangle{
	public :
		int firstPage;
		int secondPage;
		int thirdPage;
		double firstPage1;
		double secondPage1;
		double thirdPage1;
		double stem;
		double height;
		void triangle_perimeter(){
			int first_page, second_page, third_page;
			cout << "\nEnter triangle first page - ";
			cin >> first_page;
			cout << endl;
			cout << "Enter triangle second page - ";
			cin >> second_page;
			cout << endl;
			cout << "Enter triangle third page - ";
			cin >> third_page;
			cout << endl;
			
			this->firstPage = first_page;
			this->secondPage = second_page;
			this->thirdPage = third_page;
		}
		
		void triangle_area(){
			double stem, height;
			cout << "\nEnter triangle height - ";
			cin >> stem;
			cout << endl;
			cout << "Enter triangle stem - ";
			cin >> height;
			cout << endl;

			this->height = height;
			this->stem = stem;
		}
		
		
		
		int getTrianglePerimeter(){
			return (firstPage + secondPage + thirdPage);
		}
		
		double getTriangleArea(){
			return (stem*height)/2;
		}
};

class RightTriangle: public Triangle{
	public:
		void right_triangle_area(){
			double right_first_page, right_second_page;
			cout << "\nEnter first straight page - ";
			cin >> right_first_page;
			cout << endl;
			cout << "Enter second straight page - ";
			cin >> right_second_page;
			cout << endl;
			
			this->height = right_first_page;
			this->stem = right_second_page;
		}
};

int main(){	
	
	char select;
	
	startProgram();
	
	firstSelect(select);
	
	
	
	return 0;
}

	// Program start
void startProgram(){
	cout << "Hello, I'm a smart calculator!" << endl;
	cout << "I will try to contact you in a language you understand!" << endl;
	cout << "Please when making a selection enter the character that is in quotation marks!" << endl;
	cout << "If everything understand we can start!" << endl;

}

	// Make the first choice
void firstSelect(char first_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Geometry - 'G'\nArithmetic - 'A'" << endl;
	cout << "Enter the selected character - ";
	cin >> first_select;	
	if(first_select == 'G'){
		geometrySelect( first_select);
	}else if(first_select == 'A'){
		arithmeticSelect(first_select);
	}else{
		cout << "\nWrong character!" << endl;
		firstSelect(first_select);
	}
}

	// Make the geometry choice
void geometrySelect( char geometry_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Triangle - 'T'\nCircular - 'C'\nPolygons - 'P'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
	cin >> geometry_select;
	if(geometry_select == 'T'){
		triangleSelect(geometry_select);
	}else if(geometry_select == 'C'){
		circularSelect(geometry_select);
	}else if(geometry_select == 'P'){
		polygonsSelect(geometry_select);
	}else if(geometry_select == 'B'){
		firstSelect(geometry_select);
	}else{
		cout << "\nWrong character!" << endl;
		geometrySelect(geometry_select);
	}
}

	// Make the triangle choice
void triangleSelect(char triangle_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Right triangle - 'R'\nEquilateral triangle - 'E'\nDifferent side triangle - 'D'\nCircle on a triangle - 'O'\nCircle in a triangle - 'I'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
	cin >> triangle_select;
	if(triangle_select == 'R'){
		rightTriangleSelect(triangle_select);
	}else if(triangle_select == 'E'){
		equilateralTriangleSelect(triangle_select);
	}else if(triangle_select == 'D'){
		differentSideTriangleSelect(triangle_select);
	}else if(triangle_select == 'O'){
		circleOnATriangleSelect(triangle_select);
	}else if(triangle_select == 'I'){
		circleInATriangleSelect(triangle_select);
	}else if(triangle_select == 'B'){
		geometrySelect(triangle_select);
	}else{
		cout << "\nWrong character!" << endl;
		triangleSelect(triangle_select);
	}

}

	// Make the right triangle choice
void rightTriangleSelect(char right_triangle_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Perimeter - 'P'\nArea - 'A'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
	cin >> right_triangle_select;
	if(right_triangle_select == 'P'){
		RightTriangle object;
		object.triangle_perimeter();
		cout << "Triangle perimeter = " << object.getTrianglePerimeter() << endl;
		
	}else if(right_triangle_select == 'A'){
		cout << "\nWe have 2 way to solve the example,\nI will tell you what we need for each and\nyou choose the one that will help you." << endl;
		cout << "1. The stem of the triangle and the allowable height on it - 'F'\n2. Two straight pages - 'S'\nGo back - 'B'" << endl;
		cout << "Enter the selected character - ";
		cin >> right_triangle_select;
		if(right_triangle_select == 'F'){
			RightTriangle object;
			object.triangle_area();
			cout << "Triangle area = " << object.getTriangleArea() << endl;
		}else if(right_triangle_select == 'S'){
			RightTriangle object;
			object.right_triangle_area();
			cout << "Triangle area = " << object.getTriangleArea() << endl;
		}else if(right_triangle_select == 'B'){
			rightTriangleSelect(right_triangle_select);
		}else{
			cout << "\nWrong character!" << endl;
			rightTriangleSelect(right_triangle_select);
		}
	}
	
}

	// Make the equilateral triangle choice
void equilateralTriangleSelect(char equilateral_triangle_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Perimeter - 'P'\nArea - 'A'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the different side triangle choice
void differentSideTriangleSelect(char different_side_triangle_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Perimeter - 'P'\nArea - 'A'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the circle on a triangle choice
void circleOnATriangleSelect(char circle_on_a_triangle_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Perimeter - 'P'\nArea - 'A'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the circle in a triangle choice
void circleInATriangleSelect(char circle_in_a_triangle_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Perimeter - 'P'\nArea - 'A'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the circular choice
void circularSelect(char circular_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Length - 'L'\nArea - 'A'\nAngle - 'N'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the circular length choice
void circularLengthSelect(char circular_length_select){
	cout << "\nSelect what you want!" << endl;
	cout << "The length of a circle - 'L'\nArc length - 'A'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the circular area choice
void circularAreaSelect(char circular_area_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Circular area - 'C'\nSector area - 'S'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the polygons choice
void polygonsSelect(char polygons_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Parallelogram - 'P'\nTrapezoid - 'T'\nRhombus - 'R'\nRectangle - 'E'\nSquare - 'S'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
	cin >> polygons_select;
	if(polygons_select == 'P'){
		parallelogramSelect(polygons_select);
	}else if(polygons_select == 'T'){
		trapezoidSelect(polygons_select);
	}else if(polygons_select == 'R'){
		rhombusSelect(polygons_select);
	}else if(polygons_select == 'E'){
		rectangleSelect(polygons_select);
	}else if(polygons_select == 'S'){
		squareSelect(polygons_select);
	}else if(polygons_select == 'B'){
		geometrySelect(polygons_select);
	}else{
		cout << "\nWrong character!" << endl;
		polygonsSelect(polygons_select);
	}
}

	// Make the parallelogram choice
void parallelogramSelect(char parallelogram_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Perimeter - 'P'\nArea - 'A'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the trapezoid choice
void trapezoidSelect(char trapezoid_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Perimeter - 'P'\nArea - 'A'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the rhombus choice
void rhombusSelect(char rhombus_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Perimeter - 'P'\nArea - 'A'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the rectangle choice
void rectangleSelect(char rectangle_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Perimeter - 'P'\nArea - 'A'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the square choice
void squareSelect(char square_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Perimeter - 'P'\nArea - 'A'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	//make the arithmetic choice
void arithmeticSelect(char arithmetic_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Mathematical operations - 'M'\nMeasurement unit converter - 'U'\nEquation - 'E'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
	cin >> arithmetic_select;
	if(arithmetic_select == 'M'){
		mathematicalOperationsSelect(arithmetic_select);
	}else if(arithmetic_select == 'U'){
		measurementUnitsConverterSelect(arithmetic_select);
	}else if(arithmetic_select == 'E'){
		equationSelect(arithmetic_select);
	}else if(arithmetic_select == 'B'){
		firstSelect(arithmetic_select);
	}else{
		cout << "\nWrong character!" << endl;
		arithmeticSelect(arithmetic_select);
	}
}

	// Make the measurement unit converter choice
void measurementUnitsConverterSelect(char measurement_unit_converter_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Weight measurement units - 'W'\nLength measurement units - 'L'\nVolume measurement units - 'V'\nTime mesurement units - 'T'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
	cin >> measurement_unit_converter_select;
	if(measurement_unit_converter_select == 'W'){
		weightMeasurementUnitsSelect(measurement_unit_converter_select);
	}else if(measurement_unit_converter_select == 'L'){
		lenghtMeasurementUnitsSelect(measurement_unit_converter_select);
	}else if(measurement_unit_converter_select == 'V'){
		volumeMeasurementUnitsSelect(measurement_unit_converter_select);
	}else if(measurement_unit_converter_select == 'T'){
		timeMeasurementUnitsSelect(measurement_unit_converter_select);
	}else if(measurement_unit_converter_select == 'B'){
		arithmeticSelect(measurement_unit_converter_select);
	}else{
		cout << "\nWrong character!" << endl;
		measurementUnitsConverterSelect(measurement_unit_converter_select);
	}
}

	// Make the weight measurement units choice
void weightMeasurementUnitsSelect(char weight_measurement_units_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Tons to Kilogram - 'T'\nKilogram to Tons - 'K'\nTons to Gram - 'R'\nGram to Tons - 'G'\nKilogram to Gram - 'J'\nGram to Kilogram - 'H'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the length measurement units choice
void lenghtMeasurementUnitsSelect(char length_measurement_unit_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Kilometers to Meter - 'Q'\nMeters to Kilometer - 'W'\nKilometers to Centimeter - 'E'\nCentimeter to Kilometer - 'R'\nKilometer to Milimeter - 'T'\nMilimeter to Kilometer - 'Y'\nMeter to Centimeter - 'U'\nCentimeter to Meter - 'I'\nMeter to Milimeter - 'O'\nMilimeter to Meter - 'P'\nCentimeter to Milimeter - 'N'\nMilimeter to Centimeter - 'M'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the volume measurement units choice
void volumeMeasurementUnitsSelect(char volume_measurement_units_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Liter to Mililiter - 'L'\nMililiter to Liter - 'M'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the time measurement units choice
void timeMeasurementUnitsSelect(char time_measurement_units_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Hours to Minutes - 'H'\nMinutes to Hours -'G'\nHours to Second - 'J'\nSecond to Hours - 'S'\nMinutes to Second - 'D'\nSecond to Minutes - 'F'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the equation choice
void equationSelect(char equation_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Linear equation - 'L'\nQuadratic equation - 'Q'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}

	// Make the mathematical operations choice
void mathematicalOperationsSelect(char mathematical_operations_select){
	cout << "\nSelect what you want!" << endl;
	cout << "Addition - 'A'\nSubtraction - 'S'\nDivision - 'D'\nMultiplication - 'M'\nGo back - 'B'" << endl;
	cout << "Enter the selected character - ";
}