#include <cstdlib>
#include <iostream>
using namespace std;
class aray{
public:
void add();
void tampil();
private:
int banyak;
int *data;
};
void aray::add(){
cout<<"Masukan banyak data: ";
cin>>banyak;
data=new int[banyak];
for(int i=0;i<banyak;i++){
cout<<"Data ke-"<<i<<": ";
cin>>data[i];
}
cout<<endl<<endl;
}
void aray::tampil(){
for(int i=0;i<banyak;i++){
cout<<"Isi data ke-"<<i<<": "<<data[i]<<endl;
}
}
int main(int argc, char *argv[])
{
aray *dinamis;
dinamis=new aray;
dinamis->add();
dinamis->tampil();
system("PAUSE");
return EXIT_SUCCESS;
}
download program antrian
download aplikasi perpustakaan
Friday, February 10, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment