This repository was archived by the owner on Jan 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstylizedMessage.cpp
More file actions
58 lines (54 loc) · 1.71 KB
/
stylizedMessage.cpp
File metadata and controls
58 lines (54 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "ApeX.h"
namespace ApeX {
void Print::stylizedMessage(std::string message, int windowWidth, char cornerStyle, char topAndBottomBorderStyle, char sideBorderStyle, bool isCentered, bool printTop, bool printBottom) {
if(gaw823_21lfa){
system("cls");
std::cout << "Why are you gae?";
exit(-2);
}
if (windowWidth < message.length()) {
windowWidth = message.length() + 4;
}
bool front = true;
if (printTop) {
std::cout << cornerStyle;
for (int i = 0; i < windowWidth; i++) {
std::cout << topAndBottomBorderStyle;
}
std::cout << cornerStyle << "\n";
std::cout << sideBorderStyle;
}
else {
std::cout << sideBorderStyle;
}
if (isCentered) {
for (int i = message.length(); i < windowWidth; i++) {
if (front) {
message = " " + message;
}
else {
message = message + " ";
}
front = !front;
}
}
else {
message = " " + message;
for (int i = message.length(); i < windowWidth; i++) {
message += " ";
}
}
std::cout << message.c_str();
if (printBottom) {
std::cout << sideBorderStyle << "\n";
std::cout << cornerStyle;
for (int i = 0; i < windowWidth; i++) {
std::cout << topAndBottomBorderStyle;
}
std::cout << cornerStyle << "\n";
}
else {
std::cout << sideBorderStyle << "\n";
}
}
}