rod1231234

4

May 5th, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5.  
  6. class Vetor
  7. {
  8.     int *vet;
  9.     int tam;
  10. public:
  11.     Vetor(int n)
  12.     {
  13.         vet = new int [n];
  14.         tam=n;
  15.     };
  16.     ~Vetor( )
  17.     {
  18.         delete []vet;
  19.     };
  20.     void LeiaVetor ( )
  21.     {
  22.         for(int i=0;i<tam;i++)
  23.         {
  24.             cout << "Vet" << "[" << i << "]:";
  25.             cin >> vet[i];
  26.             cout << "\n";
  27.         }
  28.     };
  29.     void ImprimaVetor( )
  30.     {
  31.         for(int i=0;i<tam;i++)
  32.             cout << "Vet" << "[" << i << "]:" << vet[i] << "\n";
  33.     };
  34. };
  35. int main(void)
  36. {
  37.     Vetor V(10);
  38.     V.LeiaVetor( );
  39.     V.ImprimaVetor();
  40. };
Advertisement
Add Comment
Please, Sign In to add comment