-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinux.cpp
More file actions
91 lines (76 loc) · 2.16 KB
/
Copy pathlinux.cpp
File metadata and controls
91 lines (76 loc) · 2.16 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include <iostream>
#include <cmath>
using namespace std;
string leftUpperCorner = "┌"; // ┌
string rightUpperCorner = "┐"; // ┐
string leftBottomCorner = "└"; // └
string rightBottomCorner = "┘"; // ┘
string upwardT = "┴"; // ┴
string downwardT = "┬"; // ┬
string rightwardT = "├"; // ├
string leftwardT = "┤"; // ┤
string cross = "┼"; // ┼
string nDash = "─"; // ─
string nDash3 = "───"; // ─
string pipe = "│"; // │
void printInBox(string);
void printInGrid(string, int);
int main(){
printInBox(" Abdul Rehman ");
// printInGrid("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
}
void printInBox(string s){
int l = s.length();
cout << leftUpperCorner;
for(int i = 0; i < l; i++){
cout << nDash;
}
cout << rightUpperCorner << endl << pipe;
for(int i = 0; i < l; i++){
cout << s[i];
}
cout << pipe << endl << leftBottomCorner;
for(int i = 0; i < l; i++){
cout << nDash;
}
cout << rightBottomCorner << endl;
}
void printInGrid(string s, int gridSize){
int l = s.length();
int lines = ceil((float)l / gridSize);
int printedLines = 0;
int currentLine = 0;
for(int i = 0; i < (lines * gridSize - l); i++){
s += ' ';
}
cout << leftUpperCorner << nDash3;
for(int i = 0; i < gridSize - 1; i++){
cout << downwardT << nDash3;
}
cout << rightUpperCorner << endl;
currentLine++;
cout << pipe;
for(int i = 0; i < gridSize; i++){
cout << " " << s[printedLines * gridSize + i] << " " << pipe;
}
cout << endl;
printedLines++;
for(; currentLine < lines; currentLine++){
cout << rightwardT << nDash3;
for(int j = 0; j < gridSize - 1; j++){
cout << cross << nDash3;
}
cout << leftwardT << endl;
cout << pipe;
for(int i = 0; i < gridSize; i++){
cout << " " << s[printedLines * gridSize + i] << " " << pipe;
}
cout << endl;
printedLines++;
}
cout << leftBottomCorner << nDash3;
for(int i = 0; i < gridSize - 1; i++){
cout << upwardT << nDash3;
}
cout << rightBottomCorner << endl;
}