Minggu, 17 Januari 2010

Procedure Pengurangan & Penggabungan Dua Buah Himpunan di C++

//Procedure pengurangan dua buah himpunan
void kurang(int A[], int B[],int jum){
int i=1;
cout<<"Hasil A - B = "; while (i<=jum) { int j=1; while (A[i] != B[j]) { j++; } if (j>jum)
{
cout<<" "< }
i++;
}
}

//Procedure penggabungan dua buah himpunan
void gabung(int A[], int B[],int jum1, int jum2){
char C[20];
int i=0;
int j=0;
int k=0;
while (i {
C[k]=A[i];
i++;
k++;
}
while (j {
C[k]=B[j];
j++;
k++;
}

k=0;
cout<<"\n\nHasil penggabungan : ";
while (k<(jum1 + jum2))
{
cout< k++;
}
}

0 comments:

Posting Komentar

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Enter your email address to subscribe:

Delivered by FeedBurner

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | SharePoint Demo