Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/01/2012, 08:37
reyes33d88
 
Fecha de Ingreso: diciembre-2011
Mensajes: 5
Antigüedad: 12 años, 4 meses
Puntos: 0
Pregunta Como puedo hacer una libreria en c++?

Que tal amigos, nuevamente preguntando, tengo un codigo que es el siguiente, necesito que quede en forma de libreria, pero no se como, pudieran decirme de donde a donde es el archivo .cpp, el archivo .h?, el codigo es el siguiente



--------------------

#include <iostream>
using namespace std;

class Aritmetica
{

private:

int result;
public:

/*!
* \ SUMA
*/
int obtenerSuma (int a, int b);
float obtenerSumaf1 (float a, float b);
double obtenerSumad1 (double a, double b);


/*!
* \ RESTA
*/
int obtenerResta (int a, int b);
float obtenerRestaf1 (float a, float b);
double obtenerRestad1 (double a, double b);

/*!
* \ MULTIPLICACION
*/

int obtenerMult (int a,int b);
float obtenerMultf1 (float a,float b);
double obtenerMultd1 (double a,double b);

/*!
* \ DIVISION
*/

int obtenerDiv (int a, int b);
float obtenerDivf1 (float a, float b);
double obtenerDivd1 (double a, double b);
};
/*!
* \ IMPLEMENTANDO METODOS
*\ SUMAR, FUNCION DE ACCESO PUBLICA, REGRESA EL
*\ VALOR DEL MIEMBRO RESULT
*/

/*!
* \ SUMA
*/

int Aritmetica::obtenerSuma(int a, int b)
{
return a+b;
}
/*!
* \ SUMA FLOTANTE
*/
float Aritmetica::obtenerSumaf1(float a, float b)
{
return a+b;
}
/*!
* \ SUMA DOUBLE
*/
double Aritmetica::obtenerSumad1 (double a, double b)
{
return a+b;
}

/*!
* \ RESTA
*/
int Aritmetica::obtenerResta (int a, int b)
{
return a-b;
}
/*!
* \ RESTA FLOTANTE
*/
float Aritmetica::obtenerRestaf1 (float a, float b)
{
return a-b;
}
/*!
* \ RESTA DOUBLE
*/


double Aritmetica::obtenerRestad1 (double a, double b)
{
return a-b;
}

/*!
* \ MULTIPLICACION
*/

int Aritmetica::obtenerMult (int a, int b)
{
return a*b;
}

/*!
* \ MULTIPLICACION FLOTANTE
*/

float Aritmetica::obtenerMultf1 (float a, float b)
{
return a*b;
}

/*!
* \ MULTIPLICACION DOUBLE
*/
double Aritmetica::obtenerMultd1 (double a, double b)
{
return a*b;
}

/*!
* \ DIVISION
*/
int Aritmetica::obtenerDiv (int a, int b)
{
return a/b;
}
/*!
* \ DIVISION FLOAT
*/

float Aritmetica::obtenerDivf1 (float a, float b)
{
return a/b;
}
/*!
* \ DIVISION DOUBLE
*/
double Aritmetica::obtenerDivd1 (double a, double b)
{
return a/b;
}
/*!
* \ MAIN
*/
int main()
{
Aritmetica a = Aritmetica();

int c;
cout<<"RESULTADO DE LA SUMA ENTERA:"<<endl;
c=a.obtenerSuma (8,7);
cout<<c<<endl;
/*!
* \ IMPRESION SUMA
*/
float c1;
cout<<"RESULTADO DE LA SUMA FLOTANTE:"<<endl;
c1=a.obtenerSumaf1 (8.12,7.12);
cout<<c1<<endl;

/*!
* \ IMPRESION SUMA DOUBLE
*/
double c2;
cout<<"RESULTADO DE LA SUMA DOUBLE:"<<endl;
c2=a.obtenerSumad1 (8.12121212,7.12121212);
cout<<c2<<endl;

/*!
* \ IMPRESION RESTA
*/
int d;
cout<<"RESULTADO DE LA RESTA ENTERA:"<<endl;
d=a.obtenerResta (8,7);
cout<<d<<endl;
/*!
* \ IMPRESION RESTA FLOTANTE
*/
float d1;
cout<<"RESULTADO DE LA RESTA FLOTANTE:"<<endl;
d1=a.obtenerRestaf1 (8.12,7.12);
cout<<d1<<endl;
/*!
* \ IMPRESION RESTA DOUBLE
*/
double d2;
cout<<"RESULTADO DE LA RESTA DOUBLE:"<<endl;
d2=a.obtenerRestad1 (8.12121212,7.12121212);
cout<<d2<<endl;

/*!
* \ IMPRESION MULTIPLICACION
*/
int e;
cout<<"RESULTADO DE LA MULTIPLICACION ENTERA:"<<endl;
e=a.obtenerMult (8,7);
cout<<e<<endl;
/*!
* \ IMPRESION MULTIPLICACION FLOTANTE
*/

float e1;
cout<<"RESULTADO DE LA MULTIPLICACION FLOTANTE:"<<endl;
e1=a.obtenerMultf1 (8.12,7.12);
cout<<e1<<endl;
/*!
* \ IMPRESION MULTIPLICACION DOUBLE
*/
double e2;
cout<<"RESULTADO DE LA MULTIPLICACION DOUBLE:"<<endl;
e2=a.obtenerMultd1 (8.12121212,7.12121212);
cout<<e1<<endl;
/*!
* \ IMPRESION DIVISION
*/
int f;
cout<<"RESULTADO DE LA DIVISION ENTERA:"<<endl;
f=a.obtenerDiv (8,7);
cout<<f<<endl;;
/*!
* \ IMPRESION DIVISION FLOTANTE
*/
float f1;
cout<<"RESULTADO DE LA DIVISION FLOTANTE:"<<endl;
f1=a.obtenerDivf1 (8.12,7.12);
cout<<f1<<endl;
/*!
* \ IMPRESION DIVISION DOUBLE
*/
double f2;

cout<<"RESULTADO DE LA DIVISION DOUBLE:"<<endl;
f2=a.obtenerDivd1 (8.12121212,7.12121212);
cout<<f2<<endl;

}