
4
By:
rod1231234 on
May 5th, 2012 | syntax:
C++ | size: 0.64 KB | hits: 19 | expires: Never
#include <iostream>
using namespace std;
class Vetor
{
int *vet;
int tam;
public:
Vetor(int n)
{
vet = new int [n];
tam=n;
};
~Vetor( )
{
delete []vet;
};
void LeiaVetor ( )
{
for(int i=0;i<tam;i++)
{
cout << "Vet" << "[" << i << "]:";
cin >> vet[i];
cout << "\n";
}
};
void ImprimaVetor( )
{
for(int i=0;i<tam;i++)
cout << "Vet" << "[" << i << "]:" << vet[i] << "\n";
};
};
int main(void)
{
Vetor V(10);
V.LeiaVetor( );
V.ImprimaVetor();
};