Guest User

Untitled

a guest
Apr 22nd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. class Hesap{
  2. protected:
  3. double id;
  4. string name;
  5. string password;
  6. public:
  7. Hesap(string name1,string password1)
  8. {
  9. double randomId;
  10. srand (time(NULL));
  11. randomId=rand() % 1000;
  12.  
  13. id=randomId;
  14. name=name1;
  15. password=password1;
  16. }
  17.  
  18. string getName(){
  19. return name;
  20. }
  21. string getPassword(){
  22. return password;
  23. }
  24. double getId(){
  25. return id;
  26. }
  27.  
  28. string setName(string name2){
  29. name=name2;
  30. }
  31.  
  32. string setPw(string password2){
  33. password=password2;
  34. }
  35.  
  36. virtual void setHesapBakiye(int bakiye1){
  37. }
  38.  
  39. class Akbil: public Hesap{
  40. private:
  41.  
  42. static double bakiye;
  43.  
  44. public:
  45. Akbil(string name,string password)
  46. :Hesap(name,password)
  47. {
  48.  
  49. }
  50.  
  51. void setHesapBakiye(int bakiye1){
  52.  
  53. cout<<"Akbile yatirmak istediginiz miktar nedir?:"<<endl;
  54. cin>>bakiye1;
  55.  
  56. bakiye+=bakiye1;
  57. }
  58.  
  59.  
  60. int getAkbilInfo(){
  61.  
  62. cout<<"Hesap Id'niz:"<<id<<" Isminiz: "<<name<<" Bakiyeniz: "<<bakiye<<endl;
  63.  
  64. }
  65.  
  66. class yemekKarti: public Hesap{
  67. private:
  68.  
  69. static double bakiye;
  70.  
  71. public:
  72. yemekKarti(string name,string password)
  73. :Hesap( name, password)
  74. {
  75.  
  76. }
  77.  
  78. void setHesapBakiye(int bakiye1){
  79.  
  80. cout<<"Akbile yatirmak istediginiz miktar nedir?:"<<endl;
  81. cin>>bakiye1;
  82.  
  83. bakiye+=bakiye1;
  84. }
  85.  
  86. int getYemekKartiInfo(){
  87.  
  88. cout<<"Hesap Id'niz:"<<id<<" Isminiz: "<<name<<" Bakiyeniz: "<<bakiye<<endl;
  89.  
  90. }
  91.  
  92. int main(){
  93. int whileCondition=-1;
  94. string girisSecim;
  95.  
  96.  
  97.  
  98. vector<Hesap> createAccObj;
  99.  
  100. void hesapOlustur(vector<Hesap>& newcreateAccObj){
  101.  
  102. string name;
  103. string password;
  104. cout<<"-------------------"<<endl;
  105. cout<<"Enter your surname:"<<endl;
  106. cin>>name;
  107. cout<<"-------------------"<<endl;
  108. cout<<"Enter your password:"<<endl;
  109.  
  110. cin>>password;
  111.  
  112. Hesap newAcc(name,password);
  113. newcreateAccObj.push_back(newAcc);
  114. cout<<endl;
  115.  
  116. bool hesapLogin(vector<Hesap>& newcreateAccObj){
  117.  
  118.  
  119.  
  120.  
  121. bool k=false;
  122. string name,password;
  123. cout<<"-----------------------"<<endl;
  124. cout<<"Please enter your surname: "<<endl;
  125. cin>>name;
  126. cout<<"-----------------------"<<endl;
  127. cout<<"Please enter your password"<<endl;
  128.  
  129.  
  130. unsigned int size=newcreateAccObj.size();
  131.  
  132. for(unsigned int i=0;i<size;i++){
  133.  
  134. string checkpw=newcreateAccObj[i].getPassword();
  135. string checkname=newcreateAccObj[i].getName();
  136.  
  137.  
  138. if(checkname==name && checkpw==password ){
  139. k=true;
  140. return k;
  141.  
  142. }
  143.  
  144. }
  145.  
  146. return k;
  147.  
  148. cout<<endl<<"Hangi hesabinizla devam etmek istersiniz?"<<endl;
  149. cout<<"1-Akbil 2-Yemek Karti"<<endl;
  150. cin>>secim;
  151.  
  152. if(secim=="1"){
  153. string akbilsecim;
  154. system("CLS");
  155. cout<<"------------------------------"<<endl;
  156. cout<<"Akbil hesabiniza gecis yapildi."<<endl;
  157.  
  158. Akbil createAkbilObj(name,password);
  159.  
  160. cout<<"------------------------------"<<endl;
  161. cout<<"Seciminiz nedir?"<<endl;
  162. cout<<"1-Bakiye yukle 2-Bilgi Goruntuleme"<<endl;
  163. cout<<"---------------------------------------"<<endl;
  164. cin>>akbilsecim;
  165.  
  166. if(akbilsecim=="1"){
  167. int miktar;
  168. createAkbilObj.setHesapBakiye(miktar);
  169.  
  170. }
  171.  
  172.  
  173. else if(akbilsecim=="2"){
  174.  
  175. createAkbilObj.getAkbilInfo(); //name= boş veriyor.
  176.  
  177. }
  178.  
  179. else{
  180. cout<<"Hatali islem yaptiniz, geri yonlendiriliyorsunuz"<<endl;
  181. goto akbilSecim;
  182. }
  183.  
  184. Hesap Id'niz:4564(randomly) Isminiz:(nothing) Bakiyeniz: 456(randomly)
Add Comment
Please, Sign In to add comment