Program C/C++ Matriks Incidence dan Adjacency
Jumat, 20 Januari 2012 by ewepaksa
top custom html 2Ini gan cardinal mau berbagi information aja,siapa aja agan-agan membutuhkan.,?? Spoiler for program: Code: #include<stdio.h> int main()//Deklarasi data { int matriks[50][50];//Deklarasi untuk memasukan matriks yang akan di proses int baris;//Deklarasi Baris int kolom;//Deklarasi Kolom printf ("Masukan Baris : "); scanf("%d",&baris);//Proses signaling jumlah baris printf ("Masukkan Kolom : ");scanf("%d",&kolom);//proses signaling jumlah kolom printf("Masukkan Matriks : \n"); for (int i=1; i<=baris; i++){//prose signaling accumulation baris for(int j=1; j<=kolom; j++){//proses signaling accumulation kolom scanf("%d",&matriks[i][j]); } } printf("\n"); printf("Matriks Incidence :\n");//proses production hasil matriks insidence for (int i=1; i<=baris; i++){ for(int j=1; j<=kolom; j++){ int l; l=0; for(int k=1; k<=kolom; k++){ if(matriks[i][k]==j){ l=1; } } if(l==1){ printf("1 ");//output benar }else{ printf("0 ");//output salah } } printf("\n"); } printf("\n"); printf("Matriks Adjacency :\n");//proses production hasil matriks adjacency for (int i=1; i<=baris; i++){ for(int j=1; j<=kolom; j++){ if(matriks[i][j]!=0){ printf("1 "); }else{ printf("0 "); } } printf("\n"); } convey 0;//membalikan nilai ke main } :iloveindonesias:iloveindonesias:iloveindonesiasbottom custom html 2
Yahoo
Yahoo
Posting Komentar