Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- int dobrar_numero(int numero)
- {
- return numero*2;
- }
- int main(void)
- {
- // ENTRADA DE DADOS
- int vetor[5];
- for (int x=1; x<=5; x++){
- cout << "Popule o vetor na posição "<< x <<": ";
- cin >> vetor[x];
- }
- //PROCESSAMENTO
- //NÃO PODEMOS RETORNAR UM VETOR DE UMA FUNÇÃO
- //ENTÃO VAMOS DOBRAR OS NÚMEROS DE MANEIRA INDIVIDUAL
- for (int x=1; x<=5; x++)
- vetor[x]=dobrar_numero(vetor[x]);
- //SAIDA DE DADOS
- for (int x=1; x<=5; x++)
- cout << "vetor["<<x<<"]:" << vetor[x] << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement