Advertisement
NdaX404

uts cek

Mar 25th, 2020
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.84 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <conio.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <sstream>
  7. using namespace std;
  8.  
  9. void satuan (int a)
  10. {
  11. if (a==1) {cout<<" Satu ";}
  12. else if (a==2) {cout<<" Dua ";}
  13. else if (a==3) {cout<<" Tiga ";}
  14. else if (a==4) {cout<<" Empat ";}
  15. else if (a==5) {cout<<" Lima ";}
  16. else if (a==6) {cout<<" Enam ";}
  17. else if (a==7) {cout<<" Tujuh ";}
  18. else if (a==8) {cout<<" Delapan ";}
  19. else if (a==9) {cout<<" Sembilan ";}
  20. else if (a==10) {cout<<" Sepuluh ";}
  21. else if (a==11) {cout<<" Sebelas ";}
  22. }
  23. void terbilang (long long b)
  24.  
  25. {if (b<=11) {satuan(b);}
  26. else if ((b>11) && (b<=19))
  27. {
  28.     terbilang(b%10); cout<<"Belas ";
  29. }
  30. else if ((b>=20)&&(b<=99))
  31. {
  32.     terbilang(b/10); cout<<"Puluh "; terbilang(b%10);
  33. }
  34. else if ((b>=100)&&(b<=199))
  35. {
  36.     cout<<"Seratus "; terbilang(b%100);
  37. }
  38. else if ((b>=200)&&(b<=999))
  39. {
  40.     terbilang(b/100); cout<<"Ratus "; terbilang(b%100);
  41. }
  42. else if ((b>=1000)&&(b<=1999))
  43. {
  44.     cout<<"Seribu "; terbilang(b%1000);
  45. }
  46. else if ((b>=2000)&&(b<=9999))
  47. {
  48.     terbilang(b/1000); cout<<"Ribu "; terbilang(b%1000);
  49. }
  50. else if ((b>=10000)&&(b<=99999))
  51. {
  52.     terbilang(b/1000); cout<<"Ribu "; terbilang(b%1000);
  53. }
  54. else if ((b>=100000)&&(b<=999999))
  55. {
  56.     terbilang(b/1000); cout<<"Ribu "; terbilang(b%1000);
  57. }
  58. else if ((b>=1000000)&&(b<=999999999))
  59. {
  60.     terbilang (b/1000000); cout<<"Juta "; terbilang (b%1000000);
  61. }
  62. else if ((b>=1000000000)&&(b<=999999999999))
  63. {
  64.     terbilang (b/1000000000); cout<<"Milyar "; terbilang (b%1000000000);
  65. }
  66.     else if ((b>=1000000000000))
  67. cout<<"Maaf ! Angka Yang Anda Masukan Salah!\n\n";
  68. }
  69.  
  70. int main()
  71. {
  72.     awal:
  73.     cout<<"\t\t   +--------------------------------+"<<endl;
  74.     cout<<"\t\t    |        Politeknik TMKM         |"<<endl;
  75.     cout<<"\t\t ---+--> Ulangan Tengah Semester <---+---"<<endl;
  76.     cout<<"\t\t    |  Algoritma dan Pemograman II   |"<<endl;
  77.     cout<<"\t\t    +--------------------------------+"<<endl<<endl;
  78.    
  79.     int pilih_jurusan, semester, total, sks, praktikum, dpp, ukt;
  80.     string nama, ID_jurusan, jurusan,kode_jurusan, id_tahun1, tahun, npm,  no_urut, id_semester, kodean, email ;
  81.     cout<<"\t Nama Lengkap\t : ";getline(cin, nama);
  82.     cout<<"\t Email\t\t : ";cin>>email;
  83.     cout<<"\t No Urut\t : ";cin>>no_urut;
  84.     cout<<"\t Jurusan\t : \n\t\t\t\t 1. Teknik Komputer\n\t\t\t\t 2. Teknik Elektronika\n\t\t\t\t 3. Teknik Rekayasa Industri Otomotif\n\t\t\t\t 4. Administrasi Bisnis\n\t\t\t\t 5. Akutansi\n\t\t\t\t 6. Akutansi Perpajakan\n\t\t\t : ";cin>>pilih_jurusan;
  85.         if(pilih_jurusan==1)
  86.             {
  87.                 ID_jurusan = "TK";
  88.                 jurusan = "Teknik Komputer";
  89.                 kode_jurusan = "01";
  90.             }
  91.         else if(pilih_jurusan==2)
  92.             {
  93.                 ID_jurusan = "TE";
  94.                 jurusan = "Teknik Elektronika";
  95.                 kode_jurusan = "02";
  96.             }
  97.         else if(pilih_jurusan==3)
  98.             {
  99.                 ID_jurusan = "TRIO";
  100.                 jurusan = "Teknik Rekayasa Industri Otomotif";
  101.                 kode_jurusan = "03";
  102.             }
  103.         else if(pilih_jurusan==4)
  104.             {
  105.                 ID_jurusan = "AB";
  106.                 jurusan = "Administrasi Bisnis";
  107.                 kode_jurusan = "04";
  108.             }
  109.         else if(pilih_jurusan==5)
  110.             {
  111.                 ID_jurusan = "AK";
  112.                 jurusan = "Akutansi";
  113.                 kode_jurusan = "05";
  114.             }
  115.         else if(pilih_jurusan==6)
  116.             {
  117.                 ID_jurusan = "AKP";
  118.                 jurusan = "Akutansi Perpajakan";
  119.                 kode_jurusan = "06";
  120.             }
  121.         cout<<"\t Semester\t : ";cin>>semester;
  122.             if(semester==1)
  123.                 {
  124.                     id_semester = "01";
  125.                 }
  126.             else if(semester==2)
  127.                 {
  128.                     id_semester = "02";
  129.                 }
  130.             else if(semester==3)
  131.                 {
  132.                     id_semester = "03";
  133.                 }
  134.             else if(semester==4)
  135.                 {
  136.                     id_semester = "04";
  137.                 }
  138.             else if(semester==5)
  139.                 {
  140.                     id_semester = "05";
  141.                 }
  142.             else if(semester==6)
  143.                 {
  144.                     id_semester = "06";
  145.                 } else {
  146.                     cout<<"\n\n \t\t Input Dengan Benar";
  147.                     system("cls");
  148.                     goto awal;
  149.                 }
  150.         cout<<"\t Tahun Masuk\t : ";cin>>tahun;
  151.         id_tahun1 = tahun.substr(2,2);
  152.     tagihan:   
  153.         cout<<endl<<endl;
  154.    
  155.     cout<<"\t +---------> POLITEKNIK TMKM <---------"<<endl;
  156.     cout<<"\t | Nama Lengkap\t : "<<nama<<endl;
  157.     cout<<"\t | Semester\t : "<<id_semester<<endl;
  158.     cout<<"\t | Alamat Email\t : "<<email<<endl;
  159.     cout<<"\t | Jurusan\t : "<<jurusan<<endl;
  160.         npm =  id_tahun1+"."+kode_jurusan+"."+id_semester+"."+no_urut;
  161.            
  162.     cout<<"\t | NPM\t\t : "<<npm<<endl;
  163.     cout<<"\t | SKS\t\t : Rp ";cin>>sks;
  164.     cout<<"\t | Praktikum\t : Rp ";cin>>praktikum;
  165.     cout<<"\t | DPP\t\t : Rp ";cin>>dpp;
  166.     cout<<"\t | UKT\t\t : Rp ";cin>>ukt;
  167.     total = sks+praktikum+dpp+ukt;
  168.         if(total>10000)
  169.             {
  170.                 cout<<"\n\n\t Total Melebihi Batas Maksimum yg ditentukan,";
  171.                 getche();
  172.                 goto tagihan;
  173.             }
  174.     cout<<"\t | TOTAL\t : Rp "<<total<<endl;
  175.     cout<<"\t | TERBILANG\t :";
  176.     stringstream id_tot;
  177.     id_tot<<total;
  178.     string s;
  179.     id_tot>>s;
  180.     terbilang(total);
  181.     kodean = no_urut+"."+ID_jurusan+"."+tahun+"."+s;
  182.     cout<<endl;
  183.     cout<<"\t | Kode Tagihan\t : "<<kodean<<endl;
  184.     cout<<"\t +---------> POLITEKNIK TMKM <---------"<<endl<<endl;
  185.    
  186.    
  187.  
  188.    
  189. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement