-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShell.h
More file actions
53 lines (43 loc) · 1.9 KB
/
Copy pathShell.h
File metadata and controls
53 lines (43 loc) · 1.9 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
#pragma once
#include <string>
#include <iostream>
#include <iomanip>
#include <windows.h>
using namespace std;
template<class T> class Shell
{
public:
/*Postcondition: The header with information for user about program is displayed.
The white text framed by two lines of green asterisks.*/
void displayHeader()
{
changeTextColor(02); // green text color
cout << endl << setfill('*') << setw(90) << "*" << "\n\n";
changeTextColor(15); // white text color
cout << "\t\t This program implements work with stacks.\n\n"
<< " The program represents 2 parking garage lanes and a street as stacks with size = 10.\n"
<< " All the information about arriving or departuring cars is processed from an input file.\n"
<< " The input file contains two fields separated by a blank:\n"
<< "\t - code (A - arrival, D - departure)\n"
<< "\t - license plate number (string)\n\n"
<< " An Arrival represents push operation, Departure - pop. \n\n";
changeTextColor(02); // green text color
cout << setfill('*') << setw(90) << "*" << "\n\n\n";
changeTextColor(); // light_gray text color (console default)
}
/*Postcondition: The different from console default color is applied to one element of output.
In displayed sequence the current item has color defined as parameter for this function*/
void highlight(const string& msg, int color = 07)
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, color); // specified text color
cout << msg;
SetConsoleTextAttribute(hConsole, 07); // light_gray text color (console default)
}
/*Postcondition: All the output after this function call has color defined as its parameter.*/
void changeTextColor(int color = 07)
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, color); // specified text color
}
}; // end Shell