KONTRUKTOR

36106yqar2xkebp1.jpg 36106yqar2xkebp1.jpg36106yqar2xkebp1.jpg

/*——————————————————*/
/* PROGRAM C++ */
/*——————————————————*/
/* Nama: M. Zakqi Hendra A */
/* Kelas:2A */
/* Tanggal: */
# include <iostream.h>
# include <conio.h>

class Kompleks
{
private:
double re;
double im;
public:
Kompleks();
void info();
};

void main()
{
clrscr();
Kompleks a;
a.info();

Kompleks b;
b.info();
}
Kompleks::Kompleks()
{
cout<<“Kontruktor dijalankan…”<<endl;
re=5.2;
im=3.6;
}

void Kompleks::info()
{
cout<<“\n Bilangan kompleks:”<< endl;
cout<<” real =” << re << endl;
cout<<” imajiner=” << im << endl;
cout<< endl;
getch();
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: