Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int strleng(const char*source) {
- int cnt = 0;
- while (source) {
- ++cnt;
- }
- return cnt;
- }
- void copy(char*dest, const char*source) {
- for (int i = 0; i < strleng(source); ++i) {
- dest[i] = source[i];
- }
- }
- class BankAccount {
- public:
- void setAccount(const char* name, const char *id, double money);
- void getAccInfo() const;
- private:
- char name[50];
- char ID[20];
- double currentMoney;
- };
- void BankAccount::setAccount(const char *name, const char *id, double money) {
- copy(this->name, name);
- copy(this->ID, id);
- this->currentMoney = money;
- }
- void BankAccount::getAccInfo() const{
- cout << this->name << " " << this->ID << " " << this->currentMoney;
- }
- int main()
- {
- BankAccount borkata;
- borkata.setAccount("Boris", "0885", 350);
- borkata.getAccInfo();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement