#include <conio.h>
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <string>
#include<windows.h>
using namespace std;
int main()
{
struct program {
int diskon, hbeli, jVokal, jKonsonan, jumlahVokal, jumlahKonsonan;
float untung;
string nama, kalimat, ket, nb, user, pass;
char pa, panjangChar;
bool isHuruf, isVokal;
int hb;
int jb;
int hj;
int t;
int tb;
int jtbudi;
int ag;
int eb;
int byrag;
int byreb;
int total;
int x;
int y;
int z;
int nil4;
int nil5;
int rata;
string nim;
string pro;
int nil1;
int nil2;
int nil3;
int es;
int hasil;
int jl;
int gj;
int tpi;
int tt;
int jj;
int bpj;
int jhtk;
int jpk;
int bruto;
int tdk;
string pr;
string nm;
string pt;
string nn;
string sd;
string al;
string tj;
string st;
string kp;
};
program nil[20];
char a;
atas:
int i;
i = 1;
do
{
system("cls");
cout << "================== Login ====================" << endl;
cout << "" << endl;
cout << "Silahkan Masukan Username Anda : "; getline(cin, nil[i].user);
cout << "Silahkan Masukan Password Anda : ";
nil[i].pass = "";
nil[i].pa = _getch();
while(nil[i].pa != 13)
{
nil[i].pass.push_back(nil[i].pa);
cout << '*';
nil[i].pa = _getch();
}
if(nil[i].user == "algo" && nil[i].pass == "12345")
{
cout << "" << endl;
cout << "" << endl;
cout << "Selamat Anda Berhasil Login...." << endl;
cout << endl;
unsigned int pilihan = 0;
while(pilihan != 6)
{
cout << "MENU PILIHAN" << endl;
cout << "------------------------------" << endl;
cout << "1. Data Pedagang " << endl;
cout << "2. Data Bayar Budi " << endl;
cout << "3. slip gaji " << endl;
cout << "4. rata-rata mahasiswa " << endl;
cout << "5. huruf konsonan& huruf vokal" << endl;
cout << "6. Exit " << endl;
cout << "------------------------------" << endl;
cout << "Pilihan Anda (1-6) : "; cin >> pilihan;
cout << endl;
if (pilihan == 1)
{
program db;
char ulang;
do
{
system("cls");
cout << "Masukan Nama Pedagang : "; cin.ignore(); getline(cin, db.nama);
cout << "Masukan Nama Barang : "; cin >> db.nb;
cout << "Masukan Jumlah Barang : "; cin >> db.jb;
cout << "Masukan Harga Barang : Rp."; cin >> db.hb;
cout << "Masukan Harga Untung : Rp."; cin >> db.untung;
cout << "Masukan Jumlah Diskon (%) : "; cin >> db.diskon; cin.ignore();
db.hbeli = db.hb * db.jb;
db.hj = db.hbeli * (1 + db.diskon / 100.0);
cout << " DATA BELANJA " << endl;
cout << "=============================================================================================================" << endl;
cout << "| NAMA PEDAGANG | NAMA BARANG | JUMLAH BARANG | UNTUNG | HARGA JUAL | KETERANGAN |" << endl;
cout << "=============================================================================================================" << endl;
cout << setiosflags(ios::left) << "| " << setw(18) << db.nama;
cout << "| " << setw(13) << db.nb;
cout << "| " << setw(15) << db.jb;
cout << "| " << setw(13) << db.untung;
cout << "| " << setw(17) << db.hj;
cout << "| " << setw(20) << db.ket << "|" << endl;
cout << "=============================================================================================================" << endl;
cout << endl;
cout << " Apakah ingin Menghitung Lagi [Y/N] : "; cin >> ulang;
} while (ulang == 'y' || ulang == 'Y');
cout << endl;
system("cls");
}
else if (pilihan == 2)
{
program dt;
int n;
int budi = 1;
system("cls");
cout << "Masukkan Jumblah Teman Budi : "; cin >> n;
dt.jl = n + budi ;
cout << "Masukan Pesanan Makanan : "; cin.ignore(); getline(cin, dt.nm);
cout << "Masukan Pesanan Minuman : "; getline(cin, dt.nn);
cout << "Masukan Harga Makanan : "; cin >> dt.ag;
cout << "Masukan Harga Minuman : "; cin >> dt.es;
dt.total = dt.ag + dt.es;
dt.hasil = dt.jl * dt.total;
cout << " DATA PEMBAYARAN " << endl;
cout << "=============================================================================================================================================" << endl;
cout << "| Jumblah teman Budi dan Budi | Nama Makanan | Nama Minuman | Harga Makanan | Harga Minuman | Total | Total Bayar |" << endl;
cout << "=============================================================================================================================================" << endl;
cout << setiosflags(ios::left) << "| " << setw(30) << dt.jl;
cout << "| " << setw(18) << dt.nm;
cout << "| " << setw(13) << dt.nn;
cout << "| " << setw(16) << dt.ag;
cout << "| " << setw(20) << dt.es;
cout << "| " << setw(14) << dt.total;
cout << "| " << setw(15) << dt.hasil << "|" << endl;
cout << "=============================================================================================================================================" << endl;
cout << endl;
}
else if (pilihan == 3)
{
program dt[20];
int n;
char ulang;
do
{
system("cls");
cout << "Masukkan Jumblah Data : "; cin >> n; cin.ignore();
for(int i = 0; i < n; i++)
{
dt[i].pt = "PT.MAJU JAYA ABADI";
dt[i].sd = "Jl.Sudirman no.143";
dt[i].al = "Bandung";
cout << endl;
cout << "Data ke-" << i+1 << endl;
cout << "Masukan Periode : "; getline(cin, dt[i].pr);
cout << "Masukan Nama Karyawan : "; getline(cin, dt[i].nama);
cout << "Masukan Jabatan : "; getline(cin, dt[i].tj);
cout << "Masukan Status : "; getline(cin, dt[i].st);
cout << "Masukan PTKP : "; getline(cin, dt[i].kp);
cout << "Masukan Gaji pokok : "; cin >> dt[i].gj;
cout << "Masukan Tunjangan paket internet : "; cin >> dt[i].tpi;
cout << "Masukan Tunjangan transportasi : "; cin >> dt[i].tt;
cout << "Masukan Tunjangan BPJS : "; cin >> dt[i].bpj;
cout << "Masukan Tunjangan Jabatan : "; cin >> dt[i].jj;
cout << "Masukan Jaminan Hari Tua Karyawan : "; cin >> dt[i].jhtk;
cout << "Masukan Jaminan Pensiun Karyawan : "; cin >> dt[i].jpk; cin.ignore();
}
dt[i].bruto = dt[i].gj + dt[i].tpi + dt[i].tt + dt[i].bpj + dt[i].jj;
dt[i].tdk = dt[i].jhtk + dt[i].jpk;
cout<<" SLIP GAJI "<<endl;
cout<<dt[i].pt<<" Periode :"<<dt[i].pr<<endl;
cout<<dt[i].sd<<" Nama Karyawan :"<<dt[i].nama<<endl;
cout<<dt[i].al<<" Jabatan :"<<dt[i].tj<<endl;
cout<<" Status :"<<dt[i].st<<endl;
cout<<" PTKP :"<<dt[i].kp<<endl;
cout<<"============================================================================================================================================================="<<endl;
cout<<" PENERIMAAN "<<endl;
cout<<"============================================================================================================================================================="<<endl;
cout<<"| Nama Karyawan | Gaji Pokok | Tunj paket internet | Tunj transportasi | Tunj BPJS | Tunj Jabatan | Tunj Laptop | J Hari tua | J pensiun |"<<endl;
cout<<"============================================================================================================================================================="<<endl;
for(i=0;i<n;i++)
{
cout<<setiosflags(ios::left)<<"| "<<setw(17) <<dt[i].nama;
cout<<"| "<<setw(16);cout<< dt[i].gj;
cout<<"| "<<setw(20);cout<< dt[i].tpi;
cout<<"| "<<setw(15);cout<< dt[i].bpj;
cout<<"| "<<setw(18);cout<< dt[i].jj;
cout<<"| "<<setw(18);cout<< dt[i].gj;
cout<<"| "<<setw(18);cout<< dt[i].jhtk;
cout<<"| "<<setw(24);cout<< dt[i].jpk<<"|"<<endl;
cout<<"============================================================================================================================================================="<<endl;
cout<<"Total Penghasilan Bruto :"<<dt[i].total<<endl;
cout<<"================================================"<<endl;
cout<<"-------PENGURANGAN---------"<<endl;
cout<<"Jaminan Hari Tua Karyawan :"<<dt[i].jhtk<<endl;
cout<<"Jaminan Pensiun Karyawan :"<<dt[i].jpk<<endl;
cout<<"================================================"<<endl;
cout<<"Total Penghasilan Bruto :"<<dt[i].bruto<<endl;
cout<<"================================================"<<endl;
cout<<"TOTAL DITERIMA KARYAWAN :"<<dt[i].tdk<<endl;
cout<<"================================================"<<endl;
}
cout<<endl;
cout<<" Apakah ingin Menghitung Lagi [Y/N] : ";cin>>ulang;
}while (ulang == 'y' || ulang == 'Y');
cout<<endl;
system("cls");
}
else if (pilihan == 4)
{
program db;
int n;
system("cls");
cout << "Masukan Jumlah Data : "; cin >> n; cin.ignore();
for (int i = 0; i < n; i++)
{
cout << "Data ke-" << i+1 << endl;
cout << "Masukan Nama Mahasiswa : "; getline(cin, db.nama);
cout << "Masukan Nim : "; getline(cin, db.nim);
cout << "Masukan Prodi : "; getline(cin, db.pro);
cout << "Masukan Nilai Harian : "; cin >> db.nil1;
cout << "Masukan Nilai UTS : "; cin >> db.nil2;
cout << "Masukan Nilai UAS : "; cin >> db.nil3;
db.nil4 = db.nil1 + db.nil2 + db.nil3;
db.nil5 = db.nil4 / 3;
cout << "===============================================================================" << endl;
cout << "| Nama | NIM | Prodi | Nilai | Nilai UTS | Nilai UAS | Nilai Akhir |" << endl;
cout << "===============================================================================" << endl;
cout << setiosflags(ios::left) << "| " << setw(18) << db.nama;
cout << "| " << setw(18) << db.nim;
cout << "| " << setw(13) << db.pro;
cout << "| " << setw(13) << db.nil1;
cout << "| " << setw(13) << db.nil2;
cout << "| " << setw(17) << db.nil3;
cout << "| " << setw(20) << db.nil5 << "|" << endl;
cout << "=========================================================" << endl;
}
}
else if (pilihan == 5)
{
program db;
char ulang;
int vokal = 0;
int konsonan = 0;
do
{
system("cls");
cout << "PROGRAM MENGHITUNG KATA VOKAL & KONSONAN" << endl;
cout << "========================================" << endl;
cout << "Masukan Kalimat : ";
cin.ignore();
getline(cin, db.kalimat);
db.panjangChar = db.kalimat.length();
for(int x = 0; x < db.panjangChar; x++)
{
db.isHuruf = isalpha(db.kalimat[x]);
if(db.isHuruf)
{
db.isVokal = db.kalimat[x] == 'a' || db.kalimat[x] == 'i' || db.kalimat[x] == 'u' || db.kalimat[x] == 'e' || db.kalimat[x] == 'o' || db.kalimat[x] == 'A' || db.kalimat[x] == 'I' || db.kalimat[x] == 'U' || db.kalimat[x] == 'E' || db.kalimat[x] == 'O';
if(db.isVokal)
{
vokal++;
}
else
{
konsonan++;
}
}
}
db.jumlahVokal = vokal;
db.jumlahKonsonan = konsonan;
cout << endl;
cout << "Jumlah huruf vokal : " << db.jumlahVokal << endl;
cout << "Jumlah huruf konsonan : " << db.jumlahKonsonan << endl;
cout << endl;
cout << "Apakah ingin Menghitung Lagi [Y/N] : "; cin >> ulang;
} while (ulang == 'y' || ulang == 'Y');
cout << endl;
system("cls");
}
else if (pilihan == 6)
{
cout << "Terima Kasih! Program Selesai." << endl;
break;
}
else
{
cout << "Pilihan tidak valid, silahkan coba lagi." << endl;
}
}
}
else
{
cout << "Username atau Password Anda salah, coba lagi!" << endl;
cout << "Coba lagi [Y/N] : "; cin >> a;
}
} while (a == 'Y' || a == 'y');
}
No comments:
Post a Comment