-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththegerk_compoundPropositionalStatement_getUsableString.cpp
More file actions
133 lines (122 loc) · 3.07 KB
/
thegerk_compoundPropositionalStatement_getUsableString.cpp
File metadata and controls
133 lines (122 loc) · 3.07 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
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
123
124
125
126
127
128
129
130
131
132
133
#include 'thegerk.h'
#include 'thegerk_compoundPropositionalStatement.cpp'
#include <cstring>
std::string compoundPropositionalStatement::getUsableString() const
{
std::string output;
for(int i = 0; i < statementString.length(); i++)
{
if(isBlankSpace(statementString[i]));
else if(isOperator(statementString[i]))
output += statementString[i];
else if(isLetter(statementString[i]))
{
int adress = findvar(i);
std::string temp = convertToString(adress);
ouptut += temp;
do {i++;} while(statementString[i] == ' ' || statementString == '\n' || statementString == '\t' || (statementString >= '0' && statementString <= '9'));
}
else if(statementString[i] == S_TRUE())
output += TRUE_CHARACTER();
else if(statementString[i] == S_FALSE())
output += FALSE_CHARACTER();
else
{
std::cout << "Remove me for final program!\nI'm located in: string compoundPropositionalStatement::getUsableString() const" << std::endl;
std::cout << "There is an illegitamite character or the function is broken, you have a bug." << std::endl;
std::cout << "The character in question is: " << statementString[i] << std::endl;
pause();
}
//old code below
/*
switch(statementString[i])
{
//if space then delete
case: ' '
case: '/t'
case: '/n'
break;
//if operator then leave alone ADD NEW OPERATORS IF ANY ARE MADE (extestential and universal may be delt with differently)
case: NOT
case: AND
case: OR
case: XOR
case: BICONDITINAL
case: IMPLIES
case: IMPLIED_BY
output += statementString[i];
break;
//if constant then change to TRUE_CHARACTER or FALSE_CHARACTER
case: S_TRUE
output += TRUE_CHARACTER;
case: S_FALSE
output += FALSE_CHARACTER;
//if a variable then switch to location in variable vector
case: 'a'
case: 'b'
case: 'c'
case: 'd'
case: 'e'
case: 'f'
case: 'g'
case: 'h'
case: 'i'
case: 'j'
case: 'k'
case: 'l'
case: 'm'
case: 'n'
case: 'o'
case: 'p'
case: 'q'
case: 'r'
case: 's'
case: 't'
case: 'u'
case: 'v'
case: 'w'
case: 'x'
case: 'y'
case: 'z'
case: 'A'
case: 'B'
case: 'C'
case: 'D'
case: 'E'
case: 'F'
case: 'G'
case: 'H'
case: 'I'
case: 'J'
case: 'K'
case: 'L'
case: 'M'
case: 'N'
case: 'O'
case: 'P'
case: 'Q'
case: 'R'
case: 'S'
case: 'T'
case: 'U'
case: 'V'
case: 'W'
case: 'X'
case: 'Y'
case: 'Z'
int adress = findvar(i);
string temp = convertToString(adress);
ouptut += temp;
do {i++;} while(statementString[i] == ' ' || statementString == '\n' || statementString == '\t' || (statementString >= '0' && statementString <= '9'));
break;
//check for error
default:
cout << "Remove me for final program!\nI'm located in: string compoundPropositionalStatement::getUsableString() const" << endl;
cout << "There is an illegitamite character or the function is broken, you have a bug." << endl;
cout << "The character in question is: " << statementString[i] << endl;
pause();
*/
}
}
return output;
}