Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <cstdlib>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int dobrar_numero(int numero)
  7. {
  8.     return numero*2;
  9. }
  10.  
  11. int main(void)
  12. {
  13.     // ENTRADA DE DADOS
  14.     int vetor[5];
  15.     for (int x=1; x<=5; x++){
  16.         cout << "Popule o vetor na posição "<< x <<": ";
  17.         cin >> vetor[x];
  18.     }
  19.      //PROCESSAMENTO
  20.      
  21.     //NÃO PODEMOS RETORNAR UM VETOR DE UMA FUNÇÃO
  22.     //ENTÃO VAMOS DOBRAR OS NÚMEROS DE MANEIRA INDIVIDUAL
  23.     for (int x=1; x<=5; x++)
  24.         vetor[x]=dobrar_numero(vetor[x]);
  25.    
  26.     //SAIDA DE DADOS
  27.     for (int x=1; x<=5; x++)
  28.         cout << "vetor["<<x<<"]:" << vetor[x] << endl;
  29.        
  30.     system("pause");
  31.     return 0;
  32. }