Creating a Matrix Using Turbo/Borland C++

Now we try to make a Matrix 3 x3 using Turbo/borlan C++. In C/C++, we use array algorithm for creating a matrix. Open Turbo/Borland C++, create new “cpp” file, type code like this:

Remember, if we use function ‘cout’ we must type at the header #include<iostream.h>. Look at carefully line int A[3][3]={1,2,3,4,5,6,7,8,9};. It means that we create a matrix 3×3 similar to matrix in matlab:

A=[1 2 3;4 5 6;7 8 9]

Loops ‘for’ at that code are only for showing the content of array/matrix A[3][3]. Try code for create matrix interactively using keyboard input. Use function ‘cin’ and loops ‘for’ for positioning the element of matrix.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:


You are commenting using your account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.