irwan94

Project Alfamart

Dec 9th, 2015
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio>
  3. #include <stdio>
  4. #include "stdlib.h"
  5.  
  6. class alfamart
  7. {
  8. public:
  9. void title()
  10. {
  11. cout<<"\t\tPT SUMBER ALFARIA TRIJAYA (ALFAMART)"<<endl;
  12. cout<<"\t\t\tJl Tasikmalaya No 06"<<endl;
  13. cout<<"---------------------------------------------------------"<<endl;
  14. }
  15. void garis()
  16. {
  17. cout<<"---------------------------------------------------------"<<endl;
  18. }
  19.  
  20. int pilih;
  21. char nim[10],pass[10],jabatan[20],nama[20];
  22. };
  23. class menu
  24. {
  25. public:
  26. void login()
  27. {
  28. int count=0;
  29. alfamart alfa;
  30. menu alfa1;
  31. alfa.title();
  32.  
  33. do
  34. {
  35. cout<<"NIM\t\t:";cin>>alfa.nim;
  36. cout<<"Password\t:";cin>>alfa.pass;
  37. if(strcmp(alfa.nim,"12345")==0 && strcmp(alfa.pass,"54321")==0)
  38. {
  39. strcpy(alfa.jabatan,"Kepala Toko");
  40. strcpy(alfa.nama,"IRWAN");
  41. count=10;
  42. }
  43. else
  44. {
  45. cout<<"Salah Password"<<endl;
  46. count+=1;
  47. }
  48. }
  49. while(10>count);
  50. clrscr();
  51. alfa.title();
  52. cout<<"Nama\t:"<<alfa.nama<<endl;
  53. cout<<"Nim\t:"<<alfa.nim<<endl;
  54. cout<<"Jabatan:"<<alfa.jabatan<<endl;
  55. alfa.garis();
  56. cout<<endl;
  57. cout<<endl;
  58. cout<<endl;
  59. cout<<"Pilihan Menu :"<<endl;
  60. cout<<"1.Input Data"<<endl;
  61. cout<<"2.Keluar"<<endl;
  62. cout<<"Input Pilihan Anda :";cin>>alfa.pilih;
  63. clrscr();
  64. if(alfa.pilih==1)
  65. {
  66. alfa1.input();
  67. }
  68. else
  69. exit(1);
  70.  
  71.  
  72.  
  73. getch();
  74. }
  75. void input()
  76. { alfamart alfa;
  77. alfa.title();
  78. cout<<"Nama\t:"<<alfa.nama<<"\t\t\tJabatan\t:"<<alfa.jabatan;
  79. }
  80. };
  81.  
  82.  
  83. void main()
  84. {
  85. alfamart alfa;
  86. menu alfa1;
  87. alfa.title();
  88. cout<<"Selamat Datang di alfamart"<<endl<<endl;
  89. cout<<"Pilihan Menu :"<<endl;
  90. cout<<"1.Login"<<endl;
  91. cout<<"2.Keluar"<<endl;
  92. cout<<"Input Pilihan Anda :";cin>>alfa.pilih;
  93. clrscr();
  94. if(alfa.pilih==1)
  95. {
  96. alfa1.login();
  97. }
  98. else
  99. exit(1);
  100. getch();
  101. }
Advertisement
Add Comment
Please, Sign In to add comment