rod1231234

nat1

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