Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ||=== Build file: "no target" in "no project" (compiler: unknown) ===|
- C:UserspcDownloadsMatrices-Costructores.cpp|50|error: declaration of 'matriz1' as array of references|
- C:UserspcDownloadsMatrices-Costructores.cpp|50|error: expected ')' before ',' token|
- C:UserspcDownloadsMatrices-Costructores.cpp|50|error: prototype for 'Matriz::Matriz(...)' does not match any in class 'Matriz'|
- C:UserspcDownloadsMatrices-Costructores.cpp|6|error: candidates are: constexpr Matriz::Matriz(const Matriz&)|
- C:UserspcDownloadsMatrices-Costructores.cpp|8|error: Matriz::Matriz(int&, int&, int&, int&, int&, int&, int&)|
- C:UserspcDownloadsMatrices-Costructores.cpp|50|error: expected unqualified-id before 'int'|
- ||=== Build failed: 6 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
- #include<iostream>
- #include<cstdlib>
- using namespace std;
- class Matriz {
- public:
- Matriz (int &, int &, int &, int &, int &, int &, int &);
- ~Matriz (){};
- int A[10][10], B[10][10], C[10][10], op, f1, f2, f3, c1, c2, c3;
- };
- int main (){
- int seleccion, m1, m2, n1, n2, matriz1[10][10], matriz2[10][10];
- cout<<"Este Programa Realiza Operaciones Con Matrices"<<endl;
- cout<<" MENU:"<<endl
- <<"1.- Suma"<<endl
- <<"2.- Multiplicacion"<<endl
- <<"Seleccion: "; cin>>seleccion;
- cout<<"Dame el numero de columnas de la matriz 1: "; cin>>m1;
- cout<<"Dame el numero de filas de la matriz 1: "; cin>>n1;
- cout<<"Dame los datos: "<<endl;
- for(int i=0;i<m1;i++){
- for(int j=0;j<n1;j++){
- matriz1[i][j]=0;
- cout<<"["<<i+1<<"]"<<"["<<j+1<<"]"; cin>>matriz1[i][j];
- }}
- cout<<"Dame el numero de columnas de la matriz 2: "; cin>>m2;
- cout<<"Dame el numero de filas de la matriz 2: "; cin>>n2;
- cout<<"Dame los datos: "<<endl;
- for(int i=0;i<m2;i++){
- for(int j=0;j<n2;j++){
- matriz2[i][j]=0;
- cout<<"["<<i+1<<"]"<<"["<<j+1<<"]"; cin>>matriz1[i][j];
- }}
- Matriz ob (matriz1[10][10], matriz2[10][10], seleccion, m1, m2, n1, n2);
- cout<<"nnMatriz Resultante: n";
- for(int i=0;i<m1;i++){
- for(int j=0;j<n1;j++){
- cout<<matriz1[i][j]<<"t";
- }cout<<endl;
- }
- }
- Matriz::Matriz(int &matriz1 [10][10], int &matriz2[10][10], int &seleccion, int &m1, int &m2, int &n1, int &n2)
- {
- op=seleccion;
- c1=m1; c2=m2; f1=n1; f2=n2;
- for(int i=0;i<c1;i++){
- for(int j=0;j<f1;j++){
- A[i][j] = matriz1[i][j];
- }}
- for(int i=0;i<c2;i++){
- for(int j=0;j<f3;j++){
- B[i][j] = matriz2[i][j];
- }}
- switch (op){
- case 1:
- if (c1==c2 && f1==f2){
- c3=c1; f3=f1;
- for (int i=0;i<c3;i++){
- for(int j=0;j<f3;j++){
- C[i][j]=0;
- C[i][j]=A[i][j]+B[i][j];
- c1 = c3 ; f1 = f3;
- for(int i=0;i<c3;i++){
- for(int j=0;j<f3;j++){
- C[i][j] = matriz1[i][j];
- }}
- }} }else {
- cout<<"nnRecuerda que para realizar una suma, las filasny las columnas deben ser iguales entre ambasnmatrices.";
- }
- case 2:
- if(c1==f2){
- c3=c1; f3=f2;
- for (int i=0;i<c3;i++){
- for (int j=0;j<f3;j++){
- C[i][j]=0;
- for (int k=0;k<f1;k++){
- C[i][j]=C[i][j]+A[i][k]*B[k][j];
- }
- }
- }
- c1 = c3 ; f1 = f3;
- for(int i=0;i<c3;i++){
- for(int j=0;j<f3;j++){
- C[i][j] = matriz1[i][j];
- }}
- } else {cout<<"No se puede realizar la multiplicacion"<<endl;}
- }
- }
- Matriz (int &, int &, int &, int &, int &, int &, int &);
- Matriz::Matriz(int &matriz1 [10][10], int &matriz2[10][10], int &seleccion, int &m1, int &m2, int &n1, int &n2)
- int matriz[10];
- int variable = matriz; // ERROR: tipos incompatibles
- int matriz[10];
- int& ref = matriz; // ERROR: tipos incompatibles
- Matriz (int [][10], int [][10], int &, int &, int &, int &, int &);
- Matriz::Matriz(int matriz1 [][10], int matriz2[][10], int &seleccion, int &m1, int &m2, int &n1, int &n2)
- Matriz::Matriz(int matriz1 [10][10], int matriz2[10][10], int &seleccion, int &m1, int &m2, int &n1, int &n2)
- Matriz ob (matriz1[10][10], matriz2[10][10], seleccion, m1, m2, n1, n2);
- Matriz ob (matriz1, matriz2, seleccion, m1, m2, n1, n2);
Add Comment
Please, Sign In to add comment