Program matriks adalah sebuah program yang menghasilkan output sejenis matriks yang dipelajari dalam matematika.. Seperti berikut :
Code C++ nya :
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
void main ()
{
awal :
clrscr();
cout<<"PROGRAM MATRIK"<<endl;
cout<<"-----------------"<<endl;
int matrik[3][3];
for(int x=0;x<3;x++)
{
for(int y=0;y<3;y++)
{
cout<<"Elemen ke "<<x+1<<"."<<y+1<<" = "; cin>>matrik[x][y];
}}
cout<<"-----------------"<<endl;
cout<<endl;
cout<<"HASIL MATRIK"<<endl;
cout<<"-----------------"<<endl;
for(int x=0;x<3;x++)
{
for(int y=0;y<3;y++)
{
cout<<setw(6)<<matrik[x][y];
}
cout<<endl;
}
cout<<"-----------------"<<endl;
cout<<endl;
char z;
cout<<"ULANGI MATRIK : [Y/N] ??"<<endl;
cin>>z;
cout<<"-----------------"<<endl;
if(z=='Y')
goto awal ;
else
if(z=='N')
goto akhir ;
akhir :
cout<<"visit us :\nputramahayana.blogspot.com"<<endl;
getch();
}
{ 1 komentar... read them below or add one }
cukup membantu saya,,thanks
Posting Komentar