Skip to content

Commit a7b0f13

Browse files
committed
first push
1 parent c081536 commit a7b0f13

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+7826
-0
lines changed

Application.h

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#pragma once
2+
3+
#include <forward_list>
4+
#include <algorithm>
5+
#include <windows.h>
6+
#include <stdexcept>
7+
#include <iostream>
8+
#include <typeinfo>
9+
#include <direct.h>
10+
#include <conio.h>
11+
#include <string>
12+
#include <vector>
13+
#include <bitset>
14+
#include <stack>
15+
#include <ctime>
16+
#include <list>
17+
#include <io.h>
18+
using namespace std;
19+
20+
class Application
21+
{
22+
private:
23+
Application()
24+
{
25+
// ñîçäàâàòü îáúåêòû òèïà Application çàïðåùåíî!
26+
}
27+
28+
public:
29+
enum class Color { BLACK, DARKBLUE, DARKGREEN, DARKCYAN, DARKRED, DARKMAGENTA, DARKYELLOW, GRAY, DARKGRAY, BLUE, GREEN, CYAN, RED, MAGENTA, YELLOW, WHITE, GREY = GRAY };
30+
enum class KeyCode { BACKSPACE = 8, LEFT = 75, RIGHT = 77, UP = 72, DOWN = 80, ENTER = 13, SPACE = 32, ESCAPE = 27 };
31+
32+
static HANDLE h;
33+
static HWND hwnd;
34+
static HDC hdc;
35+
36+
static void Options(string title = "TITLE")
37+
{
38+
system("mode con cols=120 lines=50");
39+
40+
title = "title " + title;
41+
system(title.c_str());
42+
43+
// CONSOLE WINDOW CENTER SCREEN
44+
int desktop_width = GetSystemMetrics(SM_CXSCREEN);
45+
int desktop_height = GetSystemMetrics(SM_CYSCREEN);
46+
int console_width = 1000;
47+
int console_height = 750;
48+
int left_shift = (desktop_width - console_width) / 2;
49+
int top_shift = (desktop_height - console_height) / 2;
50+
MoveWindow(hwnd, left_shift, top_shift, console_width, console_height, true);
51+
52+
CONSOLE_CURSOR_INFO info;
53+
info.bVisible = false;
54+
info.dwSize = 100;
55+
SetConsoleCursorInfo(h, &info);
56+
57+
srand((unsigned int)time(0));
58+
int r = rand();
59+
60+
setlocale(0, "UKR");
61+
}
62+
63+
static void Exit()
64+
{
65+
int code = _getch();
66+
SetConsoleTextAttribute(h, (WORD)Color::BLACK);
67+
}
68+
69+
static int Rand(int min, int max)
70+
{
71+
return (rand() * rand()) % (max - min + 1) + min;
72+
}
73+
74+
static void SetConsoleColor(Color color)
75+
{
76+
SetConsoleTextAttribute(h, (WORD)color);
77+
}
78+
};
79+
80+
// â Ñ++ ñòàòè÷åñêèå ïîëÿ òàêæå äîëæíû áûòü îáúÿâëåíû çà ïðåäåëàìè êëàññà
81+
HANDLE Application::h = GetStdHandle(STD_OUTPUT_HANDLE);
82+
HWND Application::hwnd = GetConsoleWindow();
83+
HDC Application::hdc = GetDC(hwnd);

Bank.h

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#pragma once
2+
3+
#include <iostream>
4+
using namespace std;
5+
6+
class Bank
7+
{
8+
static double totalbalance;
9+
double balance;
10+
11+
public:
12+
Bank()
13+
{
14+
//cout << "default c-tor!\n";
15+
SetBalance(0);
16+
}
17+
18+
Bank(double b)
19+
{
20+
//cout << "param c-tor!\n";
21+
SetBalance(b);
22+
SetTotalbalance(GetTotalbalance() + b);
23+
}
24+
25+
private:
26+
void SetTotalbalance(double t)
27+
{
28+
totalbalance = t;
29+
}
30+
31+
public:
32+
double GetTotalbalance() const
33+
{
34+
return totalbalance;
35+
}
36+
37+
private:
38+
void SetBalance(double b)
39+
{
40+
if (b < 0) cout << "Îáğàòèòå âíèìàíèå:îòğèöàòåëüíûé áàëàíñ!\n";
41+
balance = b;
42+
}
43+
44+
public:
45+
double GetBalance()const
46+
{
47+
return balance;
48+
}
49+
50+
void GiveKredit(double k)
51+
{
52+
if (balance > k)
53+
{
54+
balance -= k;
55+
totalbalance -= k;
56+
}
57+
}
58+
void ReturnKredit(double k)
59+
{
60+
balance += 1.2 * k;
61+
totalbalance += 1.2 * k;
62+
}
63+
64+
void TakeDepozit(double d)
65+
{
66+
balance += d;
67+
totalbalance += d;
68+
}
69+
70+
void ReturnDepozit(double d)
71+
{
72+
balance -= 1.1 * d;
73+
totalbalance -= 1.1 * d;
74+
}
75+
76+
void PrintBalance()const
77+
{
78+
cout << "Áàëàíñ îäíîãî ôèëèàëà ğàâåí:" << balance << "\n";
79+
}
80+
81+
void PrintTotal()const
82+
{
83+
cout << "Îáùèé áàëàíñ áàíêà ğàâåí:" << totalbalance << "\n";
84+
}
85+
};
86+
87+
double Bank::totalbalance = 1000000;

0 commit comments

Comments
 (0)