Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4.  
  5.  
  6. int strleng(const char*source) {
  7.  
  8. int cnt = 0;
  9. while (source) {
  10. ++cnt;
  11. }
  12. return cnt;
  13. }
  14.  
  15. void copy(char*dest, const char*source) {
  16. for (int i = 0; i < strleng(source); ++i) {
  17. dest[i] = source[i];
  18. }
  19. }
  20.  
  21.  
  22.  
  23. class BankAccount {
  24. public:
  25. void setAccount(const char* name, const char *id, double money);
  26. void getAccInfo() const;
  27.  
  28. private:
  29.  
  30. char name[50];
  31. char ID[20];
  32. double currentMoney;
  33.  
  34. };
  35.  
  36. void BankAccount::setAccount(const char *name, const char *id, double money) {
  37.  
  38. copy(this->name, name);
  39. copy(this->ID, id);
  40. this->currentMoney = money;
  41. }
  42.  
  43. void BankAccount::getAccInfo() const{
  44.  
  45. cout << this->name << " " << this->ID << " " << this->currentMoney;
  46. }
  47.  
  48.  
  49. int main()
  50. {
  51. BankAccount borkata;
  52. borkata.setAccount("Boris", "0885", 350);
  53. borkata.getAccInfo();
  54.  
  55.  
  56. return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement