irwan94

Tugas no 3

Oct 15th, 2015
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. #include <conio>
  2. #include <iostream>
  3. #include <stdio>
  4. #include <windows>
  5.  
  6. void title()
  7. {
  8. cout<<"PENGINAPAN PASTI BETAH"<<endl;
  9. }
  10. void garis()
  11. {
  12. cout<<"*********************************************\n"<<endl;
  13. }
  14. main()
  15. {
  16. char ulang,kode,nama[10],tipe[20],souvenir[20];
  17. long uangkembali,uangbayar,harga,biayasewa,admin,totalbiayasewa;
  18. int lama;
  19. atas:
  20. title();
  21. garis();
  22. cout<<"Nama Penyewa\t\t:";gets(nama);
  23. cout<<"Kode Kamar [A/B/M]\t:";cin>>kode;
  24. clrscr();
  25. if(kode=='A' || kode =='a')
  26. {
  27. strcpy(tipe,"Anggrek");
  28. harga=300000;
  29. }
  30. else if(kode=='B' || kode =='b')
  31. {
  32. strcpy(tipe,"Bougenville");
  33. harga=300000;
  34. }
  35. else if(kode=='M' || kode =='m')
  36. {
  37. strcpy(tipe,"Mawar");
  38. harga=300000;
  39. }
  40. else{
  41. cout<<"SALAH KODE !!!!!!!"<<endl;
  42. goto salah;
  43. }
  44.  
  45. title();
  46. garis();
  47. cout<<"Nama Penyewa\t:"<<nama<<endl;
  48. cout<<"Kode Kamar [A/B/M]:"<<kode<<endl;
  49. cout<<"Lama Menginap\t:";cin>>lama;
  50. if(lama>=7)
  51. {
  52. strcpy(souvenir,"Payung Cantik");
  53. }
  54. else
  55. strcpy(souvenir,"Tidak Dapat souvenir");
  56.  
  57. garis();
  58. cout<<"Tipe Kamar\t:"<<tipe<<endl;
  59. cout<<"Lama Menginap\t:"<<lama<<"Hari"<<endl;
  60. cout<<"Souvenir\t:"<<souvenir<<endl;
  61. biayasewa=lama*harga;
  62. cout<<"Biaya Sewa\t:"<<biayasewa<<endl;
  63. admin=200000;
  64. cout<<"Biaya Administrasi\t:"<<admin<<endl;
  65. totalbiayasewa=biayasewa+admin;
  66. cout<<"Total Biaya Sewa\t:"<<totalbiayasewa<<endl;
  67. garis();
  68. cout<<"Uang Bayar\t:";cin>>uangbayar;
  69. uangkembali=uangbayar-totalbiayasewa;
  70. cout<<"Uang kembali\t:"<<uangkembali<<endl;
  71. salah:
  72. cout<<"Ingin Input Lagi [Y/T]:";cin>>ulang;
  73. clrscr();
  74. if(ulang == 'Y' || ulang == 'y')
  75. {
  76. goto atas;
  77. }else
  78. return(0);
  79.  
  80. getch();
  81. }
Advertisement
Add Comment
Please, Sign In to add comment