Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. // neno me podrias decir como hacer para crear arrays como objetos para poder sumarlos, llegue hasta ahi pero me fui cada vez liando mas,
  2. // lo que pretendo es crear arrays como objetos para poder sumar, introducir datos y visualizar. gracce
  3.  
  4.  
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9.  
  10.  
  11. class Matriz{
  12. private:
  13. int fil;
  14. int col;
  15. int array[0][0];
  16. public:
  17. Matriz ();
  18. ~Matriz();
  19. void SetMatriz(int f, int c);
  20. void SumarMatriz();
  21. void visualizar();
  22. int Getfil();
  23. int Getcol();
  24.  
  25. };
  26.  
  27.  
  28. Matriz::Matriz(){
  29. int f,c,v;
  30. cout<<"introduzca el numero de filas de la matriz: ";
  31. cin>> f;
  32. cout<<"introduzca el numero de columnas de la matriz: ";
  33. cin>> c;
  34. fil = f;
  35. col = c;
  36. array v = new array[f][c];
  37. }
  38. Matriz::~Matriz(){
  39. }
  40. void Matriz:: SetMatriz(int f, int c){
  41. int x;
  42. for(int i=0;i<f;i++){
  43. for(int j=0;j<c;j++){
  44.  
  45. cout<<"introduzca el dato "<<i<<j<<" "<<endl;
  46. cin>>x;
  47. array[i][j]=x;
  48. }
  49. }
  50. }
  51. int Matriz::Getfil(){
  52. return fil;
  53. }
  54. int Matriz::Getcol(){
  55. return col;
  56. }
  57.  
  58. void SumarMatriz(int a[int c][int d];int b[int c][int d]){
  59.  
  60. }
  61.  
  62. int main(){
  63.  
  64. int fila,colu;
  65. Matriz m;
  66. fila = m.Getfil();
  67. colu = m.Getcol();
  68. m.SetMatriz(fila,colu);
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement