Senin, 09 November 2015

Menghitung Biaya Kuliah Per sks menggunakan C++

Standard
Berikut Source Code nya, Copy dan jalankan aplikasi dev cpp atau yang lain :
#include <iostream>
#include <cstdlib>
#include <conio.h>
using namespace std;
struct hitung {
 int sks,type;
 double spp1,spp2;
}kuliah;
void init(),finish();
double total;
main()
{
 cout<<"Program Menghitung Biaya Kuliah \n";
 cout<<"=====================================>\n";
 cout<<"(1). D3 \n";
 cout<<"(2). S1 \n";
 init();

 cout<<"\n\n\n=====================================>";
 cout<<"\nThanks to all \n created by  \n";
 cout<<"NIM   : 2014141125\n";
 cout<<"NAMA  : Syahrial Fandrianah";
 cout<<"\n=====================================>\n";
 getch();
}
void finish(){
 char cek;
 
 cout<<"\nHitung Lagi (y/n) : ";
 cin>>cek;
 if(cek == 'y'){
  init();
 } else if(cek == 'n'){
  exit(0);
 } else {
  finish();
 }
}
 

void init(){
 cout<<"\nPilih Sesuai dengan Sarjana (1/2) :  ";
 cin>>kuliah.type;
    
 if(kuliah.type == 1){
  cout<<"\nMasukan Berapa SKS (ex:18) : ";
  cin>>kuliah.sks;
  cout<<"\n";
  kuliah.spp1 = 500000;
  kuliah.spp2 = 25000;
  total = kuliah.spp2 * kuliah.sks;
  cout<<"----------- Hasil Perhitungan D3 -----------";
 } else if(kuliah.type == 2){
  cout<<"\nMasukan Berapa SKS (ex:18) : ";
  cin>>kuliah.sks;
  cout<<"\n";
  kuliah.spp1 = 750000;
  kuliah.spp2 = 50000;
  total = kuliah.spp2 * kuliah.sks;
  cout<<"----------- Hasil Perhitungan S1 -----------";
 } else {
  init();
 }
 cout<<"\nSPP Tetap     : "<<kuliah.spp1;
 cout<<"\nSPP Var       : "<<kuliah.spp2<<"/sks ";
 cout<<"\n - Total Semua SKS = "<<kuliah.sks;
 cout<<"\n - Total Semua = "<<total;
 cout<<"\n------------------------------------------\n";
  finish();
}
Berikut Screenshot atau hasil source code yang di jalankan ;
 Terima Kasih Semoga bisa membantu ...

0 komentar:

Posting Komentar