Guest User

Untitled

a guest
May 21st, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | None | 0 0
  1. ||=== Build file: "no target" in "no project" (compiler: unknown) ===|
  2. C:UserspcDownloadsMatrices-Costructores.cpp|50|error: declaration of 'matriz1' as array of references|
  3. C:UserspcDownloadsMatrices-Costructores.cpp|50|error: expected ')' before ',' token|
  4. C:UserspcDownloadsMatrices-Costructores.cpp|50|error: prototype for 'Matriz::Matriz(...)' does not match any in class 'Matriz'|
  5. C:UserspcDownloadsMatrices-Costructores.cpp|6|error: candidates are: constexpr Matriz::Matriz(const Matriz&)|
  6. C:UserspcDownloadsMatrices-Costructores.cpp|8|error: Matriz::Matriz(int&, int&, int&, int&, int&, int&, int&)|
  7. C:UserspcDownloadsMatrices-Costructores.cpp|50|error: expected unqualified-id before 'int'|
  8. ||=== Build failed: 6 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
  9.  
  10. #include<iostream>
  11. #include<cstdlib>
  12.  
  13. using namespace std;
  14.  
  15.  
  16. class Matriz {
  17. public:
  18. Matriz (int &, int &, int &, int &, int &, int &, int &);
  19. ~Matriz (){};
  20. int A[10][10], B[10][10], C[10][10], op, f1, f2, f3, c1, c2, c3;
  21. };
  22.  
  23. int main (){
  24. int seleccion, m1, m2, n1, n2, matriz1[10][10], matriz2[10][10];
  25. cout<<"Este Programa Realiza Operaciones Con Matrices"<<endl;
  26. cout<<" MENU:"<<endl
  27. <<"1.- Suma"<<endl
  28. <<"2.- Multiplicacion"<<endl
  29. <<"Seleccion: "; cin>>seleccion;
  30.  
  31. cout<<"Dame el numero de columnas de la matriz 1: "; cin>>m1;
  32. cout<<"Dame el numero de filas de la matriz 1: "; cin>>n1;
  33. cout<<"Dame los datos: "<<endl;
  34.  
  35. for(int i=0;i<m1;i++){
  36. for(int j=0;j<n1;j++){
  37. matriz1[i][j]=0;
  38. cout<<"["<<i+1<<"]"<<"["<<j+1<<"]"; cin>>matriz1[i][j];
  39. }}
  40.  
  41. cout<<"Dame el numero de columnas de la matriz 2: "; cin>>m2;
  42. cout<<"Dame el numero de filas de la matriz 2: "; cin>>n2;
  43. cout<<"Dame los datos: "<<endl;
  44.  
  45. for(int i=0;i<m2;i++){
  46. for(int j=0;j<n2;j++){
  47. matriz2[i][j]=0;
  48. cout<<"["<<i+1<<"]"<<"["<<j+1<<"]"; cin>>matriz1[i][j];
  49. }}
  50.  
  51. Matriz ob (matriz1[10][10], matriz2[10][10], seleccion, m1, m2, n1, n2);
  52. cout<<"nnMatriz Resultante: n";
  53. for(int i=0;i<m1;i++){
  54. for(int j=0;j<n1;j++){
  55. cout<<matriz1[i][j]<<"t";
  56. }cout<<endl;
  57.  
  58. }
  59. }
  60. Matriz::Matriz(int &matriz1 [10][10], int &matriz2[10][10], int &seleccion, int &m1, int &m2, int &n1, int &n2)
  61. {
  62. op=seleccion;
  63. c1=m1; c2=m2; f1=n1; f2=n2;
  64. for(int i=0;i<c1;i++){
  65. for(int j=0;j<f1;j++){
  66. A[i][j] = matriz1[i][j];
  67. }}
  68.  
  69. for(int i=0;i<c2;i++){
  70. for(int j=0;j<f3;j++){
  71. B[i][j] = matriz2[i][j];
  72. }}
  73.  
  74. switch (op){
  75.  
  76. case 1:
  77. if (c1==c2 && f1==f2){
  78. c3=c1; f3=f1;
  79.  
  80. for (int i=0;i<c3;i++){
  81. for(int j=0;j<f3;j++){
  82. C[i][j]=0;
  83. C[i][j]=A[i][j]+B[i][j];
  84.  
  85. c1 = c3 ; f1 = f3;
  86. for(int i=0;i<c3;i++){
  87. for(int j=0;j<f3;j++){
  88. C[i][j] = matriz1[i][j];
  89. }}
  90.  
  91. }} }else {
  92. cout<<"nnRecuerda que para realizar una suma, las filasny las columnas deben ser iguales entre ambasnmatrices.";
  93. }
  94.  
  95. case 2:
  96. if(c1==f2){
  97. c3=c1; f3=f2;
  98. for (int i=0;i<c3;i++){
  99. for (int j=0;j<f3;j++){
  100. C[i][j]=0;
  101. for (int k=0;k<f1;k++){
  102. C[i][j]=C[i][j]+A[i][k]*B[k][j];
  103. }
  104. }
  105. }
  106.  
  107. c1 = c3 ; f1 = f3;
  108. for(int i=0;i<c3;i++){
  109. for(int j=0;j<f3;j++){
  110. C[i][j] = matriz1[i][j];
  111. }}
  112. } else {cout<<"No se puede realizar la multiplicacion"<<endl;}
  113. }
  114. }
  115.  
  116. Matriz (int &, int &, int &, int &, int &, int &, int &);
  117.  
  118. Matriz::Matriz(int &matriz1 [10][10], int &matriz2[10][10], int &seleccion, int &m1, int &m2, int &n1, int &n2)
  119.  
  120. int matriz[10];
  121. int variable = matriz; // ERROR: tipos incompatibles
  122.  
  123. int matriz[10];
  124. int& ref = matriz; // ERROR: tipos incompatibles
  125.  
  126. Matriz (int [][10], int [][10], int &, int &, int &, int &, int &);
  127.  
  128. Matriz::Matriz(int matriz1 [][10], int matriz2[][10], int &seleccion, int &m1, int &m2, int &n1, int &n2)
  129.  
  130. Matriz::Matriz(int matriz1 [10][10], int matriz2[10][10], int &seleccion, int &m1, int &m2, int &n1, int &n2)
  131.  
  132. Matriz ob (matriz1[10][10], matriz2[10][10], seleccion, m1, m2, n1, n2);
  133.  
  134. Matriz ob (matriz1, matriz2, seleccion, m1, m2, n1, n2);
Add Comment
Please, Sign In to add comment