fork download
  1. /// Taller 4 ///
  2.  
  3. /// 1) Hacer un programa que lea una matriz A de 4 filas por 2 columnas de enteros positivos, cree e imprima dos vectores B y C. B que contenga los nĂºmeros pares y C los impares.///
  4.  
  5.  
  6. #include <iostream>
  7. using namespace std;
  8. int main()
  9. {
  10. int i, j, A[4][2], a, b, B[8], C[8],r;
  11. for(i=0; i<=3; i++)
  12. {
  13. for(j=0; j<=1; j++)
  14. {
  15. cout << "Ingrese los Elementos de la Columna " <<j+1 <<" y Fila " <<i+1 <<" : ";
  16. cin>>A[i][j];
  17. }
  18. }
  19. a=0;
  20. b=0;
  21. for(i=0; i<=3; i++)
  22. {
  23. for(j=0; j<=1; j++)
  24. {
  25. r=A[i][j]%2;
  26. if(r==0)
  27. {
  28. B[a]=A[i][j]; // Son Pares
  29. a=a+1;
  30. C[b]=0;
  31. b=b+1;
  32. }
  33. else
  34. {
  35. B[a]=0;
  36. a=a+1;
  37. C[b]=A[i][j]; // Son Impares
  38. b=b+1;
  39. }
  40. }
  41. }
  42. for(i=0; i<=7; i++)
  43. {
  44. if(B[i]!=0)
  45. {
  46. cout << "Par: " <<B[i]<< endl;
  47. }
  48. }
  49. for(i=0; i<=7; i++)
  50. {
  51. if(C[i]!=0)
  52. {
  53. cout<< "Impar: " <<C[i]<< endl;
  54. }
  55. }
  56. system(("PAUSE"));
  57. cout<<"Yurs" <<endl;
  58. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:56: error: ‘system’ was not declared in this scope
stdout
Standard output is empty