#include <iostream>
#include <conio.h>
using namespace std;
int help=0;//lebih baik gunakan constructor
int hasil=0;//lebih baik gunakan constructor
class Amstrong
{
private :
int reverse;
int num;
int temp;
public :
int input();
int proses();
int output();
};
int Amstrong :: input()
{
cout<<"Masukan nilai : ";
cin>>num;
reverse = num;
}
int Amstrong :: proses()
{
while (num !=0)
{
temp = num % 10;
hasil = (temp*temp*temp)+hasil;
help = help * 10 + temp;
num = num/10;
}
}
int Amstrong :: output()
{
if (reverse == hasil)
cout<<"The number is amstrong number";
else
cout<<"The number is not amstrong number";
}
int main()
{
Amstrong akses;
akses.input();
akses.proses();
akses.output();
getch();
}
Subscribe to:
Post Comments (Atom)
Tutorial Lengkap Hosting Website Gratis Dengan Gambar
Hallo Guys.. sudah sangat lama sekali sejak terakhir kali saya melakukan posting di blogger ini... kalau saya tidak salah terakhir saya ...
-
suatu hari pada saat saya ingin membuat program di Dev C++ terjadi error seperti ini saat compile.. kira2 gambarnya seperti dibawah ini.. ...
-
Action Listener ? apa yang teman2 pikirkan jika mendengar tentang ini.. Sama seperti namanya Action Listener ini di gunakan pada program ja...
-
Apa itu UTP dan Fiber Optik? UTP dan Fiber Optik merupakan dua jenis kabel yang biasanya digunakan pada jaringan komputer. Dari nama ...
No comments:
Post a Comment