Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "Poliedro.h"
- class COctaedro : public CPoliedro
- {
- public:
- COctaedro(int _a);
- ~COctaedro();
- void Volumen();
- void Area();
- };
- #include "stdafx.h"
- #include "Octaedro.h"
- COctaedro::COctaedro(int _a) :CPoliedro(_a)
- {
- }
- COctaedro::~COctaedro()
- {
- }
- void COctaedro::Volumen()
- {
- float volumen;
- volumen = a*a*a * 2 / 3;
- cout << "Volumen es : " << volumen;
- }
- void COctaedro::Area()
- {
- float area;
- area = 2 * a*a*sqrt(3);
- cout << "Area es : " << area;
- }
- #pragma once
- #include "Poliedro.h"
- class CHexaedro : public CPoliedro
- {
- public:
- CHexaedro(int _a);
- ~CHexaedro();
- void Volumen();
- void Area();
- };
- #include "stdafx.h"
- #include "Hexaedro.h"
- CHexaedro::CHexaedro(int _a) :CPoliedro(_a)
- {
- }
- CHexaedro::~CHexaedro()
- {
- }
- void CHexaedro::Volumen()
- {
- float volumen;
- volumen = a*a*a;
- cout << "Volumen es : " << volumen;
- }
- void CHexaedro::Area()
- {
- float area;
- area = 6 * a*a;
- cout << "Area es : " << area;
- }
- #pragma once
- #include "Poliedro.h"
- class CTetraedro :public CPoliedro
- {
- public:
- CTetraedro(int _a);
- ~CTetraedro();
- void Area();
- void Volumen();
- };
- #include "stdafx.h"
- #include "Tetraedro.h"
- CTetraedro::CTetraedro(int _a):CPoliedro(_a)
- {
- }
- CTetraedro::~CTetraedro()
- {
- }
- void CTetraedro::Area()
- {
- float area;
- area = a*a*sqrt(3);
- cout << "Area es : " << area;
- }
- void CTetraedro::Volumen()
- {
- float volumen;
- volumen = (a*a*a*sqrt(2)) / 2;
- cout << "Volumen es : " << volumen;
- }
- // stdafx.h : include file for standard system include files,
- // or project specific include files that are used frequently, but
- // are changed infrequently
- //
- #pragma once
- #include <iostream>
- #include <conio.h>
- #include "Poliedro.h"
- #include "Tetraedro.h"
- #include "Octaedro.h"
- #include "Hexaedro.h"
- using namespace System;
- using namespace std;
- // TODO: reference additional headers your program requires here
- #pragma once
- class CPoliedro
- {
- protected:
- int a;
- public:
- CPoliedro(int _a);
- ~CPoliedro();
- };
- #include "stdafx.h"
- #include "Poliedro.h"
- CPoliedro::CPoliedro(int _a)
- {
- a = _a;
- }
- CPoliedro::~CPoliedro()
- {
- }
- // ConsoleApplication2.cpp : main project file.
- #include "stdafx.h"
- void Menu()
- {
- cout << endl << "-----------Menu-----------" << endl;
- cout << "1. Tetraedro" << endl;
- cout << "2. Hexaedro" << endl;
- cout << "3. Octaedro" << endl;
- cout << endl;
- }
- int main()
- {
- int opc;
- int a;
- CTetraedro* obj1;
- CHexaedro* obj2;
- COctaedro* obj3;
- while (1)
- {
- Menu();
- cin >> opc;
- cout << "Ingrese Arista : " << endl;
- cin >> a;
- switch (opc)
- {
- case 1:
- obj1 = new CTetraedro(a);
- obj1->Volumen();
- obj1->Area();
- break;
- case 2:
- obj2 = new CHexaedro(a);
- obj2->Volumen();
- obj2->Area();
- break;
- case 3:
- obj3 = new COctaedro(a);
- obj3->Volumen();
- obj3->Area();
- break;
- }
- }
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment