Interesuje mnie ten temat: https://simpledevcode.wordpress.com/2015/01/03/convert-infix-to-reverse-polish-notation-c-implementation/ jednak nie rozumiem dlaczego program nie działa jeśli stringa podamy w takiej formie:
string infix = "3^4+(11-(3*2))/2";
chce rozwiązać to zadanie w taki sposób aby notacje infiksową do konwersji podawać w pliku w następującej postaci:
1 // liczba wyrazen do konwersji
a+b+(~a-a) // wyrazenie do konwersji
Próbowałem robić to w taki sposób ale nic nie wyświetla:
int main() {
vector<string> tokens;//store the tokens here
ifstream in;
openFile(in);
int dataSets;
in >> dataSets;
for (int j = 0; j < dataSets; ++j) {
string infix;
istringstream iss(infix);
while (getline(in, infix)) {
while (iss) {
string temp;
iss >> temp;
chars.push_back(temp);
}
vector<string> result;//output vector
stack<string> stack;//main stack
for (unsigned int i = 0; i < tokens.size(); i++)
{
// funkcje
}
}
}
return 0;
}