mirror of
https://github.com/sam-astro/Z-Sharp.git
synced 2025-12-13 09:02:10 +00:00
Get real value of operated on items, just in case they are variables. Other stuff
This commit is contained in:
parent
6c42f6d7d3
commit
ce87bdbe81
160
Slang/Main.cpp
160
Slang/Main.cpp
@ -39,6 +39,8 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int ExecuteFunction(string functionName, vector<string> inputVarVals);
|
||||||
|
|
||||||
bool isNumber(const string& str)
|
bool isNumber(const string& str)
|
||||||
{
|
{
|
||||||
for (char const& c : str) {
|
for (char const& c : str) {
|
||||||
@ -81,6 +83,44 @@ int count(string str, char ch) {
|
|||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int countNoOverlap(string str, char ch1, char ch2) {
|
||||||
|
int cnt = 0;
|
||||||
|
|
||||||
|
bool waitingForClose = false;
|
||||||
|
|
||||||
|
for (int i = 0; i < (int)str.size(); i++)
|
||||||
|
{
|
||||||
|
if (str[i] == ch1)
|
||||||
|
waitingForClose = true;
|
||||||
|
else if (str[i] == ch2 && waitingForClose == true)
|
||||||
|
{
|
||||||
|
cnt++;
|
||||||
|
waitingForClose = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
int indexInStr(string str, char ch) {
|
||||||
|
|
||||||
|
for (int i = 0; i < (int)str.size(); i++)
|
||||||
|
if (str[i] == ch)
|
||||||
|
return i;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int charIndexInVec(vector<string> str, char ch) {
|
||||||
|
|
||||||
|
for (int i = 0; i < (int)str.size(); i++)
|
||||||
|
for (int w = 0; w < (int)str[i].size(); w++)
|
||||||
|
if (str[i][w] == ch)
|
||||||
|
return i;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int countInVector(vector<string> str, string ch) {
|
int countInVector(vector<string> str, string ch) {
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
|
||||||
@ -117,6 +157,43 @@ vector<string> removeTabs(vector<string> str, int amnt) {
|
|||||||
return newStr;
|
return newStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vector<string> rangeInVec(vector<string> str, int min, int max) {
|
||||||
|
if (max == -1)
|
||||||
|
max == (int)str.size();
|
||||||
|
|
||||||
|
vector<string> newStr;
|
||||||
|
|
||||||
|
for (int i = min; i < (int)str.size() && i < max; i++)
|
||||||
|
newStr.push_back(str[i]);
|
||||||
|
|
||||||
|
return newStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
string rangeInStr(string str, int min, int max) {
|
||||||
|
if (max == -1)
|
||||||
|
max == (int)str.size();
|
||||||
|
|
||||||
|
string newStr;
|
||||||
|
|
||||||
|
for (int i = min; i < (int)str.size() && i < max; i++)
|
||||||
|
newStr += str[i];
|
||||||
|
|
||||||
|
return newStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
string unWrapVec(vector<string> vec) {
|
||||||
|
string newStr;
|
||||||
|
|
||||||
|
for (int i = 0; i < (int)vec.size(); i++)
|
||||||
|
{
|
||||||
|
newStr += vec[i];
|
||||||
|
if (i != (int)vec.size() - 1)
|
||||||
|
newStr += " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
return newStr;
|
||||||
|
}
|
||||||
|
|
||||||
string replace(string str, string strToReplace, string replaceWith) {
|
string replace(string str, string strToReplace, string replaceWith) {
|
||||||
string newStr;
|
string newStr;
|
||||||
string savedLetters;;
|
string savedLetters;;
|
||||||
@ -163,7 +240,7 @@ string AddItem(string variableContent, string addItem)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string GetRealValue(string var, vector<string> variables, vector<string> variableVals)
|
string GetRealValue(string var, vector<string>& variables, vector<string>& variableVals)
|
||||||
{
|
{
|
||||||
if (!isNumber(var) && count(var, '\"') == 0)
|
if (!isNumber(var) && count(var, '\"') == 0)
|
||||||
{
|
{
|
||||||
@ -193,7 +270,7 @@ string GetRealValue(string var, vector<string> variables, vector<string> variabl
|
|||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BooleanLogic(string valA, string determinant, string valB, vector<string> variables, vector<string> variableVals)
|
bool BooleanLogic(string valA, string determinant, string valB, vector<string>& variables, vector<string>& variableVals)
|
||||||
{
|
{
|
||||||
string valARealValue = GetRealValue(valA, variables, variableVals);
|
string valARealValue = GetRealValue(valA, variables, variableVals);
|
||||||
string valBRealValue = GetRealValue(valB, variables, variableVals);
|
string valBRealValue = GetRealValue(valB, variables, variableVals);
|
||||||
@ -219,13 +296,55 @@ bool BooleanLogic(string valA, string determinant, string valB, vector<string> v
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ProcessLine(vector<vector<string>> words, int l, vector<string> variables, vector<string> variableValues)
|
string PEMDAS(string equ)
|
||||||
|
{
|
||||||
|
if (split(equ, ',').size() == 1)
|
||||||
|
return equ;
|
||||||
|
|
||||||
|
int parenthesisSetsCount = countNoOverlap(equ, '(', ')');
|
||||||
|
|
||||||
|
vector<string> equationWords = split(equ, ' ');
|
||||||
|
for (int s = 0; s < parenthesisSetsCount; s++)
|
||||||
|
{
|
||||||
|
int startOfNextParenthesis = 0;
|
||||||
|
int numofParenthesis = 0;
|
||||||
|
vector<string> insideParenthesis;
|
||||||
|
for (int p = startOfNextParenthesis; p < (int)equationWords.size(); p++)
|
||||||
|
{
|
||||||
|
numofParenthesis += count(equationWords[p], '(') - count(equationWords[p], ')');
|
||||||
|
if (numofParenthesis == 0)
|
||||||
|
{
|
||||||
|
startOfNextParenthesis = indexInStr(equationWords[charIndexInVec(equationWords, '(')], '(');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
insideParenthesis.push_back("");
|
||||||
|
for (int w = 0; w < (int)equationWords[p].size(); w++)
|
||||||
|
{
|
||||||
|
insideParenthesis[(int)insideParenthesis.size() - 1] += equationWords[p][w] + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
equ = replace(equ, "(" + unWrapVec(insideParenthesis) + ")", PEMDAS(unWrapVec(insideParenthesis)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProcessLine(vector<vector<string>> words, int l, vector<string>& variables, vector<string>& variableValues)
|
||||||
{
|
{
|
||||||
if (words[l][0] == "print") {
|
if (words[l][0] == "print") {
|
||||||
cout << GetRealValue(words[l][1], variables, variableValues) << endl;
|
cout << GetRealValue(words[l][1], variables, variableValues) << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Iterate through all functions
|
||||||
|
for (int t = 0; t < (int)functions.size(); t++)
|
||||||
|
{
|
||||||
|
if (words[l][0] == split(functions[t], ' ')[0])
|
||||||
|
{
|
||||||
|
ExecuteFunction(words[l][0], rangeInVec(words[l], 1, -1));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// First iterate through all types to see if line
|
// First iterate through all types to see if line
|
||||||
// is a variable then store it with it's value
|
// is a variable then store it with it's value
|
||||||
for (int t = 0; t < (int)types.size(); t++)
|
for (int t = 0; t < (int)types.size(); t++)
|
||||||
@ -234,9 +353,9 @@ int ProcessLine(vector<vector<string>> words, int l, vector<string> variables, v
|
|||||||
{
|
{
|
||||||
//Checks if it is variable
|
//Checks if it is variable
|
||||||
variables.push_back(words[l][1]);
|
variables.push_back(words[l][1]);
|
||||||
variableValues.push_back((string)words[l][3]);
|
variableValues.push_back(GetRealValue((string)words[l][3], variables, variableValues));
|
||||||
//cout << words[l][1] << " is " << words[l][3] << endl << endl;
|
//cout << words[l][1] << " is " << words[l][3] << endl << endl;
|
||||||
break;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Second, iterate all existing local variable names
|
// Second, iterate all existing local variable names
|
||||||
@ -247,16 +366,16 @@ int ProcessLine(vector<vector<string>> words, int l, vector<string> variables, v
|
|||||||
if (words[l][1] == "=")
|
if (words[l][1] == "=")
|
||||||
variableValues[v] = words[l][2];
|
variableValues[v] = words[l][2];
|
||||||
else if (words[l][1] == "+=")
|
else if (words[l][1] == "+=")
|
||||||
variableValues[v] = AddItem(variableValues[v], words[l][2]);
|
variableValues[v] = AddItem(variableValues[v], GetRealValue(words[l][2], variables, variableValues));
|
||||||
else if (words[l][1] == "-=")
|
else if (words[l][1] == "-=")
|
||||||
variableValues[v] = to_string(stof(variableValues[v]) - stof(words[l][2]));
|
variableValues[v] = to_string(stof(variableValues[v]) - stof(GetRealValue(words[l][2], variables, variableValues)));
|
||||||
else if (words[l][1] == "*=")
|
else if (words[l][1] == "*=")
|
||||||
variableValues[v] = to_string(stof(variableValues[v]) * stof(words[l][2]));
|
variableValues[v] = to_string(stof(variableValues[v]) * stof(GetRealValue(words[l][2], variables, variableValues)));
|
||||||
else if (words[l][1] == "/=")
|
else if (words[l][1] == "/=")
|
||||||
variableValues[v] = to_string(stof(variableValues[v]) / stof(words[l][2]));
|
variableValues[v] = to_string(stof(variableValues[v]) / stof(GetRealValue(words[l][2], variables, variableValues)));
|
||||||
|
|
||||||
//cout << words[l][1] << " is " << words[l][3] << endl << endl;
|
//cout << words[l][1] << " is " << words[l][3] << endl << endl;
|
||||||
break;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Third, iterate all existing global variable names
|
// Third, iterate all existing global variable names
|
||||||
@ -267,16 +386,16 @@ int ProcessLine(vector<vector<string>> words, int l, vector<string> variables, v
|
|||||||
if (words[l][1] == "=")
|
if (words[l][1] == "=")
|
||||||
globalVariableValues[v] = words[l][2];
|
globalVariableValues[v] = words[l][2];
|
||||||
else if (words[l][1] == "+=")
|
else if (words[l][1] == "+=")
|
||||||
globalVariableValues[v] = AddItem(globalVariableValues[v], words[l][2]);
|
globalVariableValues[v] = AddItem(globalVariableValues[v], GetRealValue(words[l][2], variables, variableValues));
|
||||||
else if (words[l][1] == "-=")
|
else if (words[l][1] == "-=")
|
||||||
globalVariableValues[v] = to_string(stof(globalVariableValues[v]) - stof(words[l][2]));
|
globalVariableValues[v] = to_string(stof(globalVariableValues[v]) - stof(GetRealValue(words[l][2], variables, variableValues)));
|
||||||
else if (words[l][1] == "*=")
|
else if (words[l][1] == "*=")
|
||||||
globalVariableValues[v] = to_string(stof(globalVariableValues[v]) * stof(words[l][2]));
|
globalVariableValues[v] = to_string(stof(globalVariableValues[v]) * stof(GetRealValue(words[l][2], variables, variableValues)));
|
||||||
else if (words[l][1] == "/=")
|
else if (words[l][1] == "/=")
|
||||||
globalVariableValues[v] = to_string(stof(globalVariableValues[v]) / stof(words[l][2]));
|
globalVariableValues[v] = to_string(stof(globalVariableValues[v]) / stof(GetRealValue(words[l][2], variables, variableValues)));
|
||||||
|
|
||||||
//cout << words[l][1] << " is " << words[l][3] << endl << endl;
|
//cout << words[l][1] << " is " << words[l][3] << endl << endl;
|
||||||
break;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Gathers while loop contents
|
// Gathers while loop contents
|
||||||
@ -314,6 +433,7 @@ int ProcessLine(vector<vector<string>> words, int l, vector<string> variables, v
|
|||||||
ProcessLine(words, l, variables, variableValues);
|
ProcessLine(words, l, variables, variableValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
// Gathers if statement contents
|
// Gathers if statement contents
|
||||||
if (words[l][0] == "if")
|
if (words[l][0] == "if")
|
||||||
@ -350,6 +470,7 @@ int ProcessLine(vector<vector<string>> words, int l, vector<string> variables, v
|
|||||||
ProcessLine(words, l, variables, variableValues);
|
ProcessLine(words, l, variables, variableValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -399,12 +520,10 @@ int parseSlang(string script)
|
|||||||
words.push_back(split(lines[i], ' '));
|
words.push_back(split(lines[i], ' '));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// First go through entire script and iterate through all types to see if line is a variable
|
||||||
|
// or function declaration, then store it with it's value
|
||||||
for (int lineNum = 0; lineNum < (int)words.size(); lineNum++)
|
for (int lineNum = 0; lineNum < (int)words.size(); lineNum++)
|
||||||
{
|
|
||||||
// First go through entire script and iterate through all types to see if line is a variable
|
|
||||||
// or function declaration, then store it with it's value
|
|
||||||
for (int t = 0; t < (int)types.size(); t++)
|
for (int t = 0; t < (int)types.size(); t++)
|
||||||
{
|
|
||||||
if (words[lineNum][0] == types[t])
|
if (words[lineNum][0] == types[t])
|
||||||
{
|
{
|
||||||
//Checks if it is function
|
//Checks if it is function
|
||||||
@ -449,9 +568,8 @@ int parseSlang(string script)
|
|||||||
cout << words[lineNum][1] << " is " << words[lineNum][3] << endl << endl;
|
cout << words[lineNum][1] << " is " << words[lineNum][3] << endl << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Executes main, which is the starting function
|
||||||
ExecuteFunction("Main", vector<string> {"hi"});
|
ExecuteFunction("Main", vector<string> {"hi"});
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -141,6 +141,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Main.cpp" />
|
<ClCompile Include="Main.cpp" />
|
||||||
|
<ClCompile Include="processLine.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="olcPixelGameEngine.h" />
|
<ClInclude Include="olcPixelGameEngine.h" />
|
||||||
|
|||||||
@ -18,6 +18,9 @@
|
|||||||
<ClCompile Include="Main.cpp">
|
<ClCompile Include="Main.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="processLine.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="olcPixelGameEngine.h">
|
<ClInclude Include="olcPixelGameEngine.h">
|
||||||
|
|||||||
155
Slang/processLine.cpp
Normal file
155
Slang/processLine.cpp
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
//#include <iostream>
|
||||||
|
//#include <fstream>
|
||||||
|
//#include <string>
|
||||||
|
//#include <regex>
|
||||||
|
//#include "Main.cpp"
|
||||||
|
//
|
||||||
|
//using namespace std;
|
||||||
|
//
|
||||||
|
//int ProcessLine(vector<vector<string>> words, int l, vector<string> variables, vector<string> variableValues)
|
||||||
|
//{
|
||||||
|
// if (words[l][0] == "print") {
|
||||||
|
// cout << GetRealValue(words[l][1], variables, variableValues) << endl;
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Iterate through all functions
|
||||||
|
// for (int t = 0; t < (int)functions.size(); t++)
|
||||||
|
// {
|
||||||
|
// if (words[l][0] == split(functions[t], ' ')[0])
|
||||||
|
// {
|
||||||
|
// ExecuteFunction(words[l][0], rangeInVec(words[l], 1, -1));
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // First iterate through all types to see if line
|
||||||
|
// // is a variable then store it with it's value
|
||||||
|
// for (int t = 0; t < (int)types.size(); t++)
|
||||||
|
// {
|
||||||
|
// if (words[l][0] == types[t])
|
||||||
|
// {
|
||||||
|
// //Checks if it is variable
|
||||||
|
// variables.push_back(words[l][1]);
|
||||||
|
// variableValues.push_back((string)words[l][3]);
|
||||||
|
// //cout << words[l][1] << " is " << words[l][3] << endl << endl;
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// // Second, iterate all existing local variable names
|
||||||
|
// for (int v = 0; v < (int)variables.size(); v++)
|
||||||
|
// {
|
||||||
|
// if (words[l][0] == variables[v])
|
||||||
|
// {
|
||||||
|
// if (words[l][1] == "=")
|
||||||
|
// variableValues[v] = words[l][2];
|
||||||
|
// else if (words[l][1] == "+=")
|
||||||
|
// variableValues[v] = AddItem(variableValues[v], words[l][2]);
|
||||||
|
// else if (words[l][1] == "-=")
|
||||||
|
// variableValues[v] = to_string(stof(variableValues[v]) - stof(words[l][2]));
|
||||||
|
// else if (words[l][1] == "*=")
|
||||||
|
// variableValues[v] = to_string(stof(variableValues[v]) * stof(words[l][2]));
|
||||||
|
// else if (words[l][1] == "/=")
|
||||||
|
// variableValues[v] = to_string(stof(variableValues[v]) / stof(words[l][2]));
|
||||||
|
//
|
||||||
|
// //cout << words[l][1] << " is " << words[l][3] << endl << endl;
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// // Third, iterate all existing global variable names
|
||||||
|
// for (int v = 0; v < (int)globalVariables.size(); v++)
|
||||||
|
// {
|
||||||
|
// if (words[l][0] == globalVariables[v])
|
||||||
|
// {
|
||||||
|
// if (words[l][1] == "=")
|
||||||
|
// globalVariableValues[v] = words[l][2];
|
||||||
|
// else if (words[l][1] == "+=")
|
||||||
|
// globalVariableValues[v] = AddItem(globalVariableValues[v], words[l][2]);
|
||||||
|
// else if (words[l][1] == "-=")
|
||||||
|
// globalVariableValues[v] = to_string(stof(globalVariableValues[v]) - stof(words[l][2]));
|
||||||
|
// else if (words[l][1] == "*=")
|
||||||
|
// globalVariableValues[v] = to_string(stof(globalVariableValues[v]) * stof(words[l][2]));
|
||||||
|
// else if (words[l][1] == "/=")
|
||||||
|
// globalVariableValues[v] = to_string(stof(globalVariableValues[v]) / stof(words[l][2]));
|
||||||
|
//
|
||||||
|
// //cout << words[l][1] << " is " << words[l][3] << endl << endl;
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// // Gathers while loop contents
|
||||||
|
// if (words[l][0] == "while")
|
||||||
|
// {
|
||||||
|
// vector<string> whileContents;
|
||||||
|
// vector<string> whileParameters;
|
||||||
|
//
|
||||||
|
// for (int w = 1; w < (int)words[l].size(); w++)
|
||||||
|
// whileParameters.push_back(words[l][w]);
|
||||||
|
//
|
||||||
|
// int numOfBrackets = 1;
|
||||||
|
// for (int p = l + 2; p < (int)words.size(); p++)
|
||||||
|
// {
|
||||||
|
// numOfBrackets += countInVector(words[p], "{") - countInVector(words[p], "}");
|
||||||
|
// if (numOfBrackets == 0)
|
||||||
|
// break;
|
||||||
|
// whileContents.push_back("");
|
||||||
|
// for (int w = 0; w < (int)words[p].size(); w++)
|
||||||
|
// {
|
||||||
|
// whileContents[(int)whileContents.size() - 1] += words[p][w] + " ";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// whileContents = removeTabs(whileContents, 1);
|
||||||
|
//
|
||||||
|
// vector<vector<string>> words;
|
||||||
|
// for (int i = 0; i < (int)whileContents.size(); i++)
|
||||||
|
// words.push_back(split(whileContents[i], ' '));
|
||||||
|
//
|
||||||
|
// while (BooleanLogic(whileParameters[0], whileParameters[1], whileParameters[2], variables, variableValues))
|
||||||
|
// {
|
||||||
|
// //Iterate through all lines in while loop
|
||||||
|
// for (int l = 0; l < (int)whileContents.size(); l++)
|
||||||
|
// {
|
||||||
|
// ProcessLine(words, l, variables, variableValues);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
// // Gathers if statement contents
|
||||||
|
// if (words[l][0] == "if")
|
||||||
|
// {
|
||||||
|
// vector<string> ifContents;
|
||||||
|
// vector<string> ifParameters;
|
||||||
|
//
|
||||||
|
// for (int w = 1; w < (int)words[l].size(); w++)
|
||||||
|
// ifParameters.push_back(words[l][w]);
|
||||||
|
//
|
||||||
|
// int numOfBrackets = 1;
|
||||||
|
// for (int p = l + 2; p < (int)words.size(); p++)
|
||||||
|
// {
|
||||||
|
// numOfBrackets += countInVector(words[p], "{") - countInVector(words[p], "}");
|
||||||
|
// if (numOfBrackets == 0)
|
||||||
|
// break;
|
||||||
|
// ifContents.push_back("");
|
||||||
|
// for (int w = 0; w < (int)words[p].size(); w++)
|
||||||
|
// {
|
||||||
|
// ifContents[(int)ifContents.size() - 1] += words[p][w] + " ";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// ifContents = removeTabs(ifContents, 1);
|
||||||
|
//
|
||||||
|
// vector<vector<string>> words;
|
||||||
|
// for (int i = 0; i < (int)ifContents.size(); i++)
|
||||||
|
// words.push_back(split(ifContents[i], ' '));
|
||||||
|
//
|
||||||
|
// if (BooleanLogic(ifParameters[0], ifParameters[1], ifParameters[2], variables, variableValues))
|
||||||
|
// {
|
||||||
|
// //Iterate through all lines in while loop
|
||||||
|
// for (int l = 0; l < (int)ifContents.size(); l++)
|
||||||
|
// {
|
||||||
|
// ProcessLine(words, l, variables, variableValues);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return 0;
|
||||||
|
//}
|
||||||
@ -2,39 +2,33 @@ int x = 1
|
|||||||
|
|
||||||
void Main(input)
|
void Main(input)
|
||||||
{
|
{
|
||||||
string c = 8
|
int a = 8
|
||||||
string d = 8
|
|
||||||
string e = 8
|
|
||||||
string f = 8
|
|
||||||
string g = 8
|
|
||||||
string h = 8
|
|
||||||
string i = 8
|
|
||||||
string j = 8
|
|
||||||
c /= 2
|
|
||||||
d /= 2
|
|
||||||
e /= 2
|
|
||||||
f /= 2
|
|
||||||
g /= 2
|
|
||||||
h /= 2
|
|
||||||
i /= 2
|
|
||||||
g /= 2
|
|
||||||
print input
|
print input
|
||||||
while x < 10000
|
int k = 0
|
||||||
|
while x < 1000
|
||||||
{
|
{
|
||||||
g /= 2
|
a /= 7.2
|
||||||
h /= 2
|
a += 9.12867
|
||||||
i /= 2
|
int xThou = x
|
||||||
g /= 2
|
xThou /= 10000
|
||||||
|
a *= xThou
|
||||||
|
|
||||||
x += 1
|
x += 1
|
||||||
|
|
||||||
if x > 0
|
if x > 0
|
||||||
{
|
{
|
||||||
print x
|
print a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x += 1
|
Next "seen"
|
||||||
print x
|
|
||||||
x -= 1
|
|
||||||
print x
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Main "hi"
|
void Next()
|
||||||
|
{
|
||||||
|
string green = "bean"
|
||||||
|
|
||||||
|
print green
|
||||||
|
}
|
||||||
|
|
||||||
|
Main hi
|
||||||
Loading…
x
Reference in New Issue
Block a user