JOINT IMPLEMENTATION DIMENSIONAL ARRAY 1 AND 2 DIMENSIONS


Array 2 Dimensional much in use to create a matrix or table data, while the one-dimensional Array in use to make the results or data that berkoordinat X only. In this post two-dimensional array in use to accommodate the values ​​of a component of mathematical equations. While one-dimensional Array used to hold the result or the value of the equation. 
# Include <cstdlib>
# Include <iostream>

using namespace std;

class xyz {/ / declaring class xyz
  public: / / pendeklarsian function xyz, enter, process and exit
     xyz ();
     void enter ();
     void process ();
     void exit ();
  
  private: / / declaring variables a, b and x, y, z
     float a [3] [3];
     float b [3];
     float x, y, z;
     };

xyz:: xyz () {/ / pendeskripsian function xyz
   court <<"\ t \ tSlamet Icelandic Al Hidayah" <<endl;
   court <<"\ t \ t 10018075" <<endl;
   court <<endl;
   court <<"Looking for Value x, y, z from Equation 3 \ n \ n";
   }

void xyz:: get () {/ / entry function pendeskripsian
   for (int i = 0; i <3; i + +) {
   court <<"Equal to" <<i +1 <<":"<< endl;
   court <<"component x:";
   cin>> a [i] [0]; / / insert the value x of an equation
    court <<"y components:";
    cin>> a [i] [1]; / / insert the value y of an equation
    court <<"z components:";
    cin>> a [i] [2]; / / insert the value z of an equation
    court <<"result:";
    cin>> b [i]; / / insert the equation from an equation
    court <<endl;
    }
     / / Display the equation
   court <<"\ nPersamaanya:" <<endl;
   for (int i = 0; i <3; i + +) {
   court <<a [i] [0] <<"x +" <<a [i] [1] <<"y +" <<a [i] [2] <<"z =" <<b [ i] <<endl;}
   }

void xyz:: process () {/ / declaring the function of the process
   for (int i = 1; i> 0; i -) {/ / loop starts from i = 1 until i> 0
     for (int j = 0; j <= 2; j + +) {
       a [i] [j] = a [i] [j] - a [i-1] [j]; / / scoring a
       }
    }

   for (int i = 2; i> 1; i -) {/ / loop starts from i = 2 to i> 1
     for (int j = 0; j <= 2; j + +) {
       a [i] [j] = a [i] [j] - a [i-2] [j];
       }
     }

   for (int i = 2; i> 1; i -) {/ / loop starts from i = 2 to i> 1
     for (int j = 0; j <= 2; j + +) {
       a [i] [j] = a [i] [j] - (2 * a [i-1] [j]);
       }
    }

   b [1] = b [1] - b [0]; / / assignment b
   b [2] = b [2] - b [0];
   b [2] = b [2] - (2 * b [1]);
 
   z = b [2] / a [2] [2]; / / assignment to the variable z
   y = b [1] - (a [1] [2] * z); / / assignment to the variable y
   x = b [0] - (a [0] [1] * y) - (a [0] [2] * z); / / assignment to the variables x
   }

void xyz:: exit () {/ / exit function pendeskripsian
   court <<endl;
   court <<"The value of x =" <<x <<endl;
   court <<"The value y =" <<y <<endl;
   court <<"The value of z =" <<z <<endl;
   court <<endl <<endl;
   }

int main (int argc, char * argv [])
{
  xyz a;
  a.masuk ();
  a.proses ();
  a.keluar ();

system ("PAUSE");
return EXIT_SUCCESS;
}
Output :


Well that's the program that I can make,,,,,!
If there are less jelass know any mistake, do not hesitate to leave a comment ataun advice. So that I can fix it later terimakasihh over his visit,,
Regards super ..

0 Response to " JOINT IMPLEMENTATION DIMENSIONAL ARRAY 1 AND 2 DIMENSIONS "