Advertisement
LuandaBernardo

Lista 2 - Q08

Nov 22nd, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. /*Faça um programa que leia um vetor com 5 nomes, e imprima estes nomes enumerados pela ordem em que foram digitados.
  2. Exemplo de saída: 1- José
  3. 2-Carlos
  4. 3-Marta
  5. 4-Lucas
  6. 5-Alex*/
  7.  
  8. #include<stdio.h>
  9. #include<conio.h>
  10.  
  11.  
  12. main ()
  13. {
  14. char    vetor[5][30];
  15. int i;
  16.    
  17. for (i=0; i<5; i++)
  18. {
  19.     printf ("\n Digite um nome %d : ", i+1);
  20.     scanf ("%s",&vetor[i]);
  21. }
  22.  
  23. for (i=0; i<5; i++)
  24. {
  25.     printf ("\n %d - %s",i+1, &vetor[i]);
  26.    
  27. }
  28.  
  29.     getch();
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement