Friday, 1 June 2012

Menggabungkan 2 Buah Elemen Array

Bentuk C++

#include <iostream>
#include <string>

using namespace std;
int main()
{

int n;
int i;
int j;
int a[10];
int b[10];

cout<<"menggabungkan 2 buah array"<<endl;
cout<<"Masukkan n = ";
cin >> n;
i =1;
cout << "Array A : " << endl; while (!(i>n))
{
raptor_prompt_variable_zzyz ="Input data";
cout << "data ke ["<<i<<",1] = ";
cin >> a[i]; i =i+1;
}
cout << "......................................................." << endl; cout << "Array B : " << endl; j =1;
while (!(j>n))
{
raptor_prompt_variable_zzyz ="Input data";
cout << "data ke ["<<j<<",1] = ";
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;
}


Bentuk Raptor


0 comments:

Post a Comment

.

.

.

.
Design by BlogSpotDesign | Ngetik Dot Com