#include <iostream>
#include <conio.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int n, baris, kolom;
int data[20];
int matriks[50][50];
void input(){
cout << " Banyak array 1 dimensi "; cin >> n;
for (int i=0;i<n;i++){
cout << " Masukan Data Ke- " << i+1; cin >> data[i];
cout << endl;
}
}
void dimensi1(){
cout << " Data Array 1 Dimensi " << endl;
for (int j=0;j<n;j++){
cout << data[j]<< " ";
}
cout << endl;
}
void proses(){
cout << " Array 2 Dimensi "<< endl;
cout << " "<<endl;
cout << " Banyak Kolom yang diinginkan : "; cin >> kolom;
cout << " Banyak Baris yang diinginkan : "; cin >> baris;
int d=0;
for ( int k=0;k<baris;k++){
for (int l=0;l<kolom;l++){
dimensi1[k][l]=data[d];
d++;
}
cout << endl;
}
}
void output1(){
cout << " Data Array 2 Dimensi " << endl;
for ( int k=0;k<baris;k++){
for (int l=0;l<kolom;l++){
cout << dimensi1[k][l];
}
}cout << endl;
}
void tukar (int *a, int *b){
int temp;
temp=*a;
*b=temp;
}
void buble(int x[]. int n){
int i,j;
for (i=0;i<n-1;i++){
for (int j=i+1;j<n;j++){
if(x[i]>x[j]){
tukar(&x[i],&x[j]);
}
}
}
}
void cetak(const int array[], int n){
int i;
for (i=0;i<n;i++){
cout << array[i]<<" ";
}
}
int main(int argc, char** argv) {
input();
dimensi1();
proses();
output1();
return 0;
}
Jumat, 17 Juni 2016
Home »
Algoritma Pemrograman
» Menukur Posisi antara Kolom dan Baris
0 komentar:
Posting Komentar