-
Notifications
You must be signed in to change notification settings - Fork 2
/
DWN_utilityd.cpp
122 lines (99 loc) · 2.15 KB
/
DWN_utilityd.cpp
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
118
119
120
121
122
#include "stdafx.h"
#include "DWN_utilityd.h"
//Psuedo-Global variables
int TEMPA = 0;
int TEMPB = 0;
int TEMPC = 0;
//Global variables just for the purpose of debugging.
void Inc_TempA()
{
++TEMPA;
}
void Show_TempA()
{
cout << endl << "TEMPORARY A'S VALUE IS: " << TEMPA;
}
void Inc_TempB()
{
++TEMPB;
}
void Show_TempB()
{
cout << endl << "TEMPORARY B'S VALUE IS: " << TEMPB;
}
void Inc_TempC()
{
++TEMPC;
}
void Show_TempC()
{
cout << endl << "TEMPORARY C'S VALUE IS: " << TEMPC;
}
//Debug function---
void Say_Hi()
{
cout << endl << "HEY THERE! HOPE YOU SEE ME ELSE THE SHIT HAS HIT THE FAN.";
}
void Show_String(const char* cstring)
{
cout << endl << cstring;
}
void Show_Num(int num)
{
cout << endl << num;
}
void Show_Num(double num)
{
cout << endl << num;
}
void Show_Nums(const int* nums)
{
cout << endl << nums[0] << " " << nums[1] << " " << nums[2];
}
void Show_Nums(const double* nums)
{
cout << endl << nums[0] << " " << nums[1] << " " << nums[2];
}
void Show_File(const char* file_name, bool pause_mode)
{
ifstream show_file(file_name, ios::in);
if (show_file.is_open())
{
char test;
bool is_letter;
bool is_number;
bool is_special;
cout << endl << "File Read Starts on Next Line: " << endl;
while (!show_file.eof())
{
show_file.get(test);
is_letter = Is_Text(test);
is_number = Is_Number(test);
is_special = ( (test >= 32) && (test <= 47) )
|| ( (test >= 58) && (test <= 64) )
|| ( (test >= 91) && (test <= 96) )
|| ( (test >= 123) && (test <= 126) );
//Additional ASCII characters that would be
//output as characters, not ASCII integers.
if (is_letter || is_number || is_special)
{
cout << test;
}
else
{
cout << int(test) << " ";
}
if (test == '\n')
//Process the end of line.
{
cout << endl;
if (pause_mode)
{
system("PAUSE");
}
}
}
cout << endl << "End File Read!";
show_file.close();
}
}