I'm compiling a C++ program which and I get the error "two or more data types in declaration" at the line below. Here is the code:
#include <iostream>
#include <string>
#include <sstream>
#include <stdlib.h>
List SplitInflix(const string infix)
{
List tokenlist;
string word= "";
char x;
for (char x : infix)
{
switch (x)
{
case '(':
if (word != "")
{
Token* token = new Token(word);
tokenlist.append(token);
word = "";
Token * token1 = new Token(LEFT);
tokenlist.append(token1);
}
else
{
Token * token = new Token(LEFT);
tokenlist.append(token);
}
break;
...
}
return tokenlist;
}
I get the error:
error: two or more data types in declaration of 'x'
There's more coding but it's too long and I think it's not related to the error.
How do I fix it. Thanks!
Aucun commentaire:
Enregistrer un commentaire