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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
COORD CursorPosition;
void gotoXY(int x, int y);
void gotoXY(int x, int y, string text);
void Draw(int style, int col, int row, int length, int amount, bool filled, int shadow);
int main(int)
{
// Draw routine
// first number = 1 for single line, 2 for a double lines
// second number = column's across
// third number = row's down
// fourth number = box total length
// fifth number = box total height
// sixth number = 0 for not filled, 1 for filled
// a way to clear just a portion of the screen.
//seventh number = 0 for no shadow, 1 for a light shadow, 2 for medium shadow, 3 for a dark shadow and 4 for a solid shadow.
char holder;
Draw(1, 2, 1, 76, 23, 0, 0); // Box, 1 line, around screen
Draw(2, 12, 4, 56, 16, 1, 3); // Box, 2 lines, around screen
gotoXY(30, 5, "Welcome to E-Post Office");
gotoXY(30, 7, "What would you like to do?");
gotoXY(30, 10, "1 - Add New Record");
gotoXY(30, 11, "2 - Display All Records");
gotoXY(30, 12, "3 - Search Record");
gotoXY(30, 13, "4 - Delete Record");
gotoXY(30, 14, "5 - Update Record");
gotoXY(30, 15, "0 - Exit");
gotoXY(30, 17, "Enter your choice _\b");
cin >> holder;
gotoXY(25, 14);
Sleep(2500);
//return 0;
}
void gotoXY(int x, int y)
{
CursorPosition.X = x;
CursorPosition.Y = y;
SetConsoleCursorPosition(console, CursorPosition);
}
void gotoXY(int x, int y, string text)
{
CursorPosition.X = x;
CursorPosition.Y = y;
SetConsoleCursorPosition(console, CursorPosition);
cout << text;
}
void Draw(int style, int col, int row, int length, int amount, bool fill, int sw)
{
// Draws a 1 or 2 line box
int a;
if (sw >4)
sw = 4;
style = (style - 1) * 6;
char box[12];
char shdw[5];
box[0] = '\xDA';// ┌
box[1] = '\xBF';// ┐
box[2] = '\xC0';// └
box[3] = '\xD9';// ┘
box[4] = '\xB3';// │
box[5] = '\xC4';// ─
box[6] = '\xC9';// ╔
box[7] = '\xBB';// ╗
box[8] = '\xC8';// ╚
box[9] = '\xBC';// ╝
box[10] = '\xBA';// ║
box[11] = '\xCD';// ═
shdw[1] = '\xB0';// ░
shdw[2] = '\xB1';// ▒
shdw[3] = '\xB2';// ▓
shdw[4] = '\xDB';// █
char tl, tr, bl, br, side, edge, shadow;
tl = box[style];
tr = box[style + 1];
bl = box[style + 2];
br = box[style + 3];
side = box[style + 4];
edge = box[style + 5];
shadow = shdw[sw];
string Line(length - 2, edge);
string Shadow(length, shadow);
string Fill(length - 2, ' ');
gotoXY(col, row);
cout << tl << Line << tr;
for (a = 1; a <amount - 1; a++)
{
gotoXY(col, row + a);
cout << side;
if (fill)
cout << Fill;
else
gotoXY(col + length - 1, row + a);
cout << side;
if (sw)
cout << shadow;
}
gotoXY(col, (amount + row) - 1);
cout << bl << Line << br;
if (sw)
{
cout << shadow;
gotoXY(col + 1, row + amount, Shadow);
}
}
|