domingo, 22 de febrero de 2015

Creando Librerias Propias Visual C++


Saving.h

class Saving
{
public:

 double deposit( double amount );

 unsigned int accountNumber;
 double balance;
};

Saving.cpp

#include <cstdlib>
#include <iostream>
#include "Saving.h"


double Saving :: deposit( double amount )
{
 balance += amount;
 return balance;
}

Main.cpp

#include <cstdlib>
#include <iostream>
#include "Saving.h"

using namespace std;


int main( int argc , char *argv[] )
{
 Saving s;

 s.accountNumber = 123456;
 s.balance = 0.0;

 cout << "Depositando 10 a la cantidad" << endl;

 s.deposit( 10 );

 cout << "El balance es: " << s.balance << endl;

 system("pause");
 return 0;
}

No hay comentarios:

Publicar un comentario