About Me

Followers

Friday, July 29, 2011

Program untuk membaca anggota dua buah himpunan A dan B kemudian mengirimkan hasil A x B

            #include <iostream>
            #include <conio.h>
            #include <string.h>
using namespace std;
int main(){
intbanyakA, banyakB;
string A[10],B[10];
cout<<"MasukkanbanyaknyahimpunanIne : ";
cin>>banyakA;
cout<<"Masukkanbanyaknyahimpunan Ica : ";
cin>>banyakB;
cout<<endl;
cout<<"HimpunanIne = ";
for(int i=0; i<banyakA; i++){
cin>>A[i];
            }
cout<<endl;
cout<<"Himpunan Ica = ";
for(int j=0; j<banyakB; j++){
cin>>B[j];
            }

cout<<endl;
cout<<"HimpunanIne = {";
for(int i=0; i<banyakA; i++){
cout<<A[i]<<",";
            }
cout<<"}";
cout<<endl;
cout<<"Himpunan Ica = {";
for(int j=0; j<banyakB; j++){
cout<<B[j]<<",";
            }
cout<<"}";
cout<<endl;
cout<<"HimpunanIne x Himpunan Ica = {";
for(int i=0; i<banyakA; i++){
for(int j=0; j<banyakB; j++){
cout<<"("<<A[i]<<",";
cout<<B[j]<<"),";
            }
            }
cout<<"}";
getch();
return 0;
            }

0 Komentar Terbaik

Post a Comment