#include <iostream>
#include <conio.h>
#include<cmath>
using namespace std;
class data{
public:
void penjumlahan();
void pengurangan();
void perkalian();
void pembagian();
void kuadrat();
void akar();
void pangkat();
void pangkat01();
void tampilan();
void login();
void menu();
void loading();
void loading01();
void akhir();
private:
float a,b,c,n;
char nama[200];
};
void data::tampilan(){
cout<<"\n\n\n\n\n\n\n\n\n\n\n";
cout<<" :: Untuk menjalankan program ini silakan masukkan nama anda ::\n\n";
cout<<" ==> Nama : ";cin>>nama;
cout<<endl;
system("CLS");
loading();
system("CLS");
cout<<"\n\n\n\n\n\n\n\n\n\n\n";
cout<<" :: Data telah tersimpan di database :: \n\n\n\n\n\n\n\n\n\n\n\n"<<endl;
system("pause");
system("CLS");
cout<<"\n\n\n\n\n\n"<<endl;
cout<<" :: Hello, "<<nama<<" ::"<<endl<<endl;
cout<<" ============================================================\n";
cout<<" == ==\n";
cout<<" == SELAMAT DATANG DALAM PROGRAM KALKULATOR KAMI ==\n";
cout<<" == ==\n";
cout<<" ============================================================\n";
cout<<endl;
cout<<" ( Untuk melanjutkan silakan tekan ENTER ) \n";
cout<<"\n\n\n\n\n\n\n"<<endl;
system("pause");
login();
}
void data::login(){
system("CLS");
int password;
int kunci;
kunci=123456;
cout<<"\n\n\n\n\n\n\n\n\n\n\n";
cout<<" :: Password dalam bentuk digit angka ::\n";
cout<<" ( Mengandung 6 digit angka ) \n\n";
cout<<" ==> Masukkan Password : ";
cin>>password;
if (password == kunci){
system("CLS");
loading01();
system("CLS");
loading01();
system("CLS");
loading01();
system("CLS");
cout<<"\n\n\n\n\n\n\n\n\n\n\n";
cout<<" [ Login SUCCESS ]"<<endl<<endl;
cout<<"\n\n\n\n\n\n\n\n\n\n\n";
system("pause");
system("CLS");
menu();
}
else{
system("CLS");
loading01();
system("CLS");
cout<<"\n\n\n\n\n\n\n\n\n\n";
cout<<" [ Paswword INVALID ]"<<endl<<endl;
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n";
system("pause");
login();
}
}
void data::menu() {
depan:
int pilih;
system("CLS");
cout<<endl;
cout<<" "<<char(201);
for(int i=1; i<40; i++){
cout<<char(205);
}
cout<<char(187)<<endl;
cout<<" "<<char(186)<< " Dibuat oleh : "<<char(186)<<endl;
cout<<" "<<char(186)<< " Nama : Wahyudi "<<char(186)<<endl;
cout<<" "<<char(186)<< " Nim : 09018121 "<<char(186)<<endl;
cout<<" "<<char(200);
for(int i=1; i<40; i++){
cout<<char(205);
}
cout<<char(188)<<endl;
cout<<endl;
cout<<endl<<endl;
cout<<" "<<char(5)<<" Program Kalkulator Sederhana "<<char(5)<<endl;
cout << " Menu : "<<endl;
cout << " 1. Penjumlahan "<<endl;
cout << " 2. Pengurangan "<<endl;
cout << " 3. Perkalian "<<endl;
cout << " 4. Pembagian "<<endl;
cout << " 5. Kuadrat <Pangkat 2> "<<endl;
cout << " 6. Akar "<<endl;
cout << " 7. x^y <x Pangkat y> "<<endl;
cout << " 8. 10^n <10 Pangkat n> "<<endl;
cout << " 9. Keluar Program "<<endl<<endl;
cout << " Masukkan Pilihan : ";
cin >> pilih;
if (pilih == 1) {
penjumlahan();
}
else if (pilih == 2) {
pengurangan();
}
else if (pilih == 3) {
perkalian();
}
else if (pilih == 4) {
pembagian();
}
else if (pilih == 5) {
kuadrat();
}
else if (pilih == 6) {
akar();
}
else if (pilih == 7) {
pangkat01();
}
else if (pilih == 8) {
pangkat();
}
else if (pilih == 9) {
system("CLS");
ulang:
char pilih;
cout<<"\n\n ";
cout<<endl;
cout << " Apakah anda yakin ingin mengakhiri program ini ??? [Y] / [T] \n";
cout << " Masukkan Pilihan : ";
cin >> pilih;
cout<<endl;
switch (pilih ) {
case 'y':
system("CLS");
loading();
system("CLS");
cout<<"\n\n\n\n\n\n"<<endl;
cout<<" ================================================== \n";
cout<<" == == \n";
cout<<" == Terima kasih telah menggunakan program ini == \n";
cout<<" == Semoga dapat bermanfaat "<<char(1)<<" == \n";
cout<<" == == \n";
cout<<" ================================================== \n\n\n\n\n";
cout<<"\n\n\n\n\n\n"<<endl;
break;
case 't':
system("CLS");
menu();
break;
default:
system("CLS");
cout<<"\n\n\n\n\n\n\n";
cout <<" ================================================== \n";
cout <<" == Pilihan ILEGAL ! ! ! == \n";
cout <<" ================================================== \n";
cout<<"\n\n\n\n\n\n\n";
system("pause");
system("CLS");
goto ulang;
cout << endl;
}
}
else {
system("CLS");
cout <<"\n\n\n\n\n\n\n";
cout <<" ================================================== \n";
cout <<" == == \n";
cout <<" == Pilihan ILEGAL ! ! ! == \n";
cout <<" == Tekan ENTER untuk kembali ke menu utama == \n";
cout <<" == == \n";
cout <<" ================================================== \n";
cout<<"\n\n\n\n\n\n\n";
system("pause");
system("CLS");
goto depan;
}
}
void data::loading(){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n loading"<<endl;
cout<<" _________________________________________________"<<endl;
cout<<" ";
for(long int i=1;i<50;i++){
for(long int x=0;x<5000;x++){
for(long int y=0;y<5000;y++){}
}
cout<<"|";
}
cout<<endl;
}
void data::loading01(){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n "<<endl;
cout<<" Silakan tunggu";
cout<<" ";
for(long int i=1;i<=10;i++){
for(long int x=0;x<5000;x++){
for(long int y=0;y<5000;y++){}
}
cout<<".";
}
}
void data::penjumlahan(){
system("CLS");
cout<<"\n ==> Penjumlahan <==\n\n";
cout<<"Masukkan Nilai ke-1 : ";cin>>a;
cout<<"Masukkan Nilai ke-2 : ";cin>>b;
cout<<"Penjumlahan dari : "<<a<<" + "<<b<<" = "<<a+b<<endl;
ulang:
char pilih;
cout<<"\n\n ";
cout<<endl;
cout << "Apakah anda ingin mengulang ??? [Y] / [T] \n";
cout << "Masukkan Pilihan : ";
cin >> pilih;
cout<<endl;
switch (pilih ) {
case 'y':
system("CLS");
penjumlahan();
cout<<endl;
break;
case 't':
system("CLS");
menu();
break;
default:
system("CLS");
cout<<"\n\n\n\n\n\n\n";
cout <<" ================================================== \n";
cout <<" == Pilihan ILEGAL ! ! ! == \n";
cout <<" ================================================== \n";
cout<<"\n\n\n\n\n\n\n";
system("pause");
system("CLS");
goto ulang;
cout << endl;
}
}
void data::pengurangan(){
system("CLS");
cout<<"\n ==> Pengurangan <==\n\n";
cout<<"Masukkan Nilai ke-1 : ";cin>>a;
cout<<"Masukkan Nilai ke-2 : ";cin>>b;
cout<<"Pengurangan dari : "<<a<<" - "<<b<<" = "<<a-b<<endl;
ulang:
char pilih;
cout<<"\n\n ";
cout<<endl;
cout << "Apakah anda ingin mengulang ??? [Y] / [T] \n";
cout << "Masukkan Pilihan : ";
cin >> pilih;
cout<<endl;
switch (pilih ) {
case 'y':
system("CLS");
pengurangan();
cout<<endl;
break;
case 't':
system("CLS");
menu();
break;
default:
system("CLS");
cout<<"\n\n\n\n\n\n\n";
cout <<" ================================================== \n";
cout <<" == Pilihan ILEGAL ! ! ! == \n";
cout <<" ================================================== \n";
cout<<"\n\n\n\n\n\n\n";
system("pause");
system("CLS");
goto ulang;
cout << endl;
}
}
void data::perkalian(){
system("CLS");
cout<<"\n ==> Perkalian <==\n\n";
cout<<"Masukkan Nilai ke-1 : ";cin>>a;
cout<<"Masukkan Nilai ke-2 : ";cin>>b;
cout<<"Perkalian dari : "<<a<<" x "<<b<<" = "<<a*b<<endl;
ulang:
char pilih;
cout<<"\n\n ";
cout<<endl;
cout << "Apakah anda ingin mengulang ??? [Y] / [T] \n";
cout << "Masukkan Pilihan : ";
cin >> pilih;
cout<<endl;
switch (pilih ) {
case 'y':
system("CLS");
perkalian();
cout<<endl;
break;
case 't':
system("CLS");
menu();
break;
default:
system("CLS");
cout<<"\n\n\n\n\n\n\n";
cout <<" ================================================== \n";
cout <<" == Pilihan ILEGAL ! ! ! == \n";
cout <<" ================================================== \n";
cout<<"\n\n\n\n\n\n\n";
system("pause");
system("CLS");
goto ulang;
cout << endl;
}
}
void data::pembagian(){
system("CLS");
cout<<"\n ==> Pembagian <==\n\n";
cout<<"Masukkan Nilai ke-1 : ";cin>>a;
cout<<"Masukkan Nilai ke-2 : ";cin>>b;
cout<<"Pembagian dari : "<<a<<" : "<<b<<" = "<<a/b<<endl;
ulang:
char pilih;
cout<<"\n\n ";
cout<<endl;
cout << "Apakah anda ingin mengulang ??? [Y] / [T] \n";
cout << "Masukkan Pilihan : ";
cin >> pilih;
cout<<endl;
switch (pilih ) {
case 'y':
system("CLS");
pembagian();
cout<<endl;
break;
case 't':
system("CLS");
menu();
break;
default:
system("CLS");
cout<<"\n\n\n\n\n\n\n";
cout <<" ================================================== \n";
cout <<" == Pilihan ILEGAL ! ! ! == \n";
cout <<" ================================================== \n";
cout<<"\n\n\n\n\n\n\n";
system("pause");
system("CLS");
goto ulang;
cout << endl;
}
}
void data::kuadrat(){
system("CLS");
cout<<"\n ==> Kuadrat <Pangkat 2> <==\n\n";
cout<<"Masukkan Nilai : ";cin>>a;
cout<<"Kuadrat dari "<<a<<" = "<<a*a<<endl;
ulang:
char pilih;
cout<<"\n\n ";
cout<<endl;
cout << "Apakah anda ingin mengulang ??? [Y] / [T] \n";
cout << "Masukkan Pilihan : ";
cin >> pilih;
cout<<endl;
switch (pilih ) {
case 'y':
system("CLS");
kuadrat();
cout<<endl;
break;
case 't':
system("CLS");
menu();
break;
default:
system("CLS");
cout<<"\n\n\n\n\n\n\n";
cout <<" ================================================== \n";
cout <<" == Pilihan ILEGAL ! ! ! == \n";
cout <<" ================================================== \n";
cout<<"\n\n\n\n\n\n\n";
system("pause");
system("CLS");
goto ulang;
cout << endl;
}
}
void data::akar(){
system("CLS");
cout<<"\n ==> Akar <==\n\n";
double y;
cout<<"Masukkan Nilai : ";cin>>a;
y=sqrt(a);
cout<<"Akar Kuadrat dari : sqrt("<<a<<") = "<<y<<endl;
ulang:
char pilih;
cout<<"\n\n ";
cout<<endl;
cout << "Apakah anda ingin mengulang ??? [Y] / [T] \n";
cout << "Masukkan Pilihan : ";
cin >> pilih;
cout<<endl;
switch (pilih ) {
case 'y':
system("CLS");
akar();
cout<<endl;
break;
case 't':
system("CLS");
menu();
break;
default:
system("CLS");
cout<<"\n\n\n\n\n\n\n";
cout <<" ================================================== \n";
cout <<" == Pilihan ILEGAL ! ! ! == \n";
cout <<" ================================================== \n";
cout<<"\n\n\n\n\n\n\n";
system("pause");
system("CLS");
goto ulang;
cout << endl;
}
}
void data::pangkat(){
system("CLS");
cout<<"\n ==> 10^n <10 Pangkat n> <==\n\n";
cout<<"Masukkan nilai n : ";
cin>>n;
if (n == 0){
cout<<"10 Pangkat "<<n<<" = 1";
}
else{
cout<<endl;
cout<<"10 Pangkat "<<n<<" = 1";
for (int x=0;x<n;x++){
cout<<0;
}
}
cout<<endl<<endl;
ulang:
char pilih;
cout<<"\n\n ";
cout<<endl;
cout << "Apakah anda ingin mengulang ??? [Y] / [T] \n";
cout << "Masukkan Pilihan : ";
cin >> pilih;
cout<<endl;
switch (pilih ) {
case 'y':
system("CLS");
pangkat();
cout<<endl;
break;
case 't':
system("CLS");
menu();
break;
default:
system("CLS");
cout<<"\n\n\n\n\n\n\n";
cout <<" ================================================== \n";
cout <<" == Pilihan ILEGAL ! ! ! == \n";
cout <<" ================================================== \n";
cout<<"\n\n\n\n\n\n\n";
system("pause");
system("CLS");
goto ulang;
cout << endl;
}
}
void data::pangkat01(){
system("CLS");
cout<<"\n ==> x^y <x Pangkat y> <==\n\n";
cout<<"Masukkan nilai x : ";cin>>a;
cout<<"Masukkan nilai y : ";cin>>b;
c = pow(a,b);
cout<<"Nilai "<<a<<" pangkat "<<b<<" adalah "<< c<<endl;
cout<<endl<<endl;
ulang:
char pilih;
cout<<"\n\n ";
cout<<endl;
cout << "Apakah anda ingin mengulang ??? [Y] / [T] \n";
cout << "Masukkan Pilihan : ";
cin >> pilih;
cout<<endl;
switch (pilih ) {
case 'y':
system("CLS");
pangkat01();
cout<<endl;
break;
case 't':
system("CLS");
menu();
break;
default:
system("CLS");
cout<<"\n\n\n\n\n\n\n";
cout <<" ================================================== \n";
cout <<" == Pilihan ILEGAL ! ! ! == \n";
cout <<" ================================================== \n";
cout<<"\n\n\n\n\n\n\n";
system("pause");
system("CLS");
goto ulang;
cout << endl;
}
}
int main(int argc, char *argv[])
{
data umum;
umum.tampilan();
system("PAUSE");
return EXIT_SUCCESS;
}