I have 2 error for my code when i compile and i need some guidance =)
This is a small part of my program.
Here's my code.

I declare my function like below:

void working (Stack& deck, Stack& deckStack, List* column, Stack* stack, bool& loadGame, bool& exitGame, bool& newGame, char user[40], int& num, int& from, int& to, bool& next)
{
    int k =13,j;
    string file, x;
    char a;
    char userInput[2];

It shows error: invalid initialization of reference of type 'Stack&' from expression of type 'std::string'

x = strstr (user, " ");
file = x.erase(0,1);
save(file, deck, deckStack, column, stack); // error here
newGame = true;
break;

second error are as below:
error: expected primary-expression before '{' token
error: expected `;' before '{' token

userInput = {user[5], user[6]};   //error here
 num = atoi(userInput);
 userInput = {user[24], user[25]};  //error here
 from = atoi(userInput); from--;
 userInput = {user[36],user[37]};   //error here
 to = atoi(userInput);
 to--;
 move (3, num, from, to, deckStack, column, stack);

Kindly if anyone know my problem please guide me. Thanks =)

Erm..i solved the 1st problem~
Now left the second one =) Any helps?

What is user input declared as? It looks as if you a re trying to use an initialize list. Make sure your compiler is able to use that feature if that is what you are doing.

My userInput is declared as array.

Extended initializer lists are only available with C++0x.Maybe you should assign each element by directly indexing it

userInput[0]=user[5]; 
 userInput[1]=user[6];

Thx alot =)
You guys were great~

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.