Changing array of one-dimensional to two-dimensional
#include <iostream>
#include <string>
using namespace std;
int main()
{
int n;
int i;
int j;
int a[50];
int b[50];
cout<<"__________________ARRAY 1-2 DIMENSI(SortingRekursif)________________"<<endl;
cout<<"Masukkan n : ";
cout<<endl;
cin >> n;
i =1;
cout << "Array A" << endl; while (!(i>n))
{
cout<<"Masukkan Data :";
cout <<endl;
cout << "data ke ["<<i<<",1]" << endl;
cin >> a[i]; i =i+1;
}
cout << "_____________________________________________________________________" << endl;
cout << "Array B " << endl; j =1;
while (!(j>n))
{
cout<<"Masukkan Data :";
cout <<endl;
cout << "data ke ["<<j<<",1]" << endl;
cin >> b[j]; j =j+1;
}
cout << "____________________________________________________________________" << endl;
cout << "Matriks Dua Dimensi" << endl; i =1;
while (1)
{
j =1;
if (i>n) break;
while (!(j>2))
{
cout << "data ke ["<<i<<","<<j<<"] = "<<a[i] << endl; j =j+1;
}
i =i+1;
}
system("pause");
return 0;
}
Comments
Post a Comment