Overwriting array values(noob)

Hi i'm a total noob to c++ and programming in general. i followed some tutorials and i think i know a little bit of what something mean(lol)
so i tried this challenge on cplusplus.com/forum/articles/12974/ and i tried the tic tac toe one after completing everything before it. and here is my code. my question will follow after the code.

#include "pch.h"
#include <iostream>

using namespace std;

int main()
{
for (int x; x = 9; x++)
{
char Placement[9] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', };

int PlacementHandler;

//cout << Placement[0] << Placement[1] << Placement[2] << endl
//<< Placement[3] << Placement[4] << Placement[5] <<
//endl << Placement[6] << Placement[7] << Placement[8] << endl;

cout << "type any number between 1 and 9 to place your marker in that respectable place" << endl;

cin >> PlacementHandler;

switch (PlacementHandler)
{
case '1':
Placement[0] = x;
break;
case '2':
Placement[1] = x;
break;
case '3':
Placement[2] = x;
break;
case '4':
Placement[3] = x;
break;
case '5':
Placement[4] = x;
break;
case '6':
Placement[5] = x;
break;
case '7':
Placement[6] = x;
break;
case '8':
Placement[7] = x;
break;
case '9':
Placement[8] = x;
break;
}
cout << Placement[0] << Placement[1] << Placement[2] << endl
<< Placement[3] << Placement[4] << Placement[5] <<
endl << Placement[6] << Placement[7] << Placement[8] << endl;

}

system("PAUSE");
return 0;
}


btw. i don't want an answer to the entier challenge only how to do this part. i was trying to print a tic tax toe board wich should look like this

123
456
789

and if you typed 1 it should replace 1 with the letter x. but i still cant figure out how. again i dont want any other answers of how to do the entire thing because that would ruin the fun. thanks in advance.
and im using visual studio 2017 btw
Nevermind i fixed it.
here is the fixed code

#include "pch.h"
#include <iostream>

using namespace std;

int main()
{
for (int x;x = 9;x++)
{
char Placement[9];

char PlacementHandler;

char* ptr = Placement;

//cout << Placement[0] << Placement[1] << Placement[2] << endl
//<< Placement[3] << Placement[4] << Placement[5] <<
//endl << Placement[6] << Placement[7] << Placement[8] << endl;

cout << "type any number between 1 and 9 to place your marker in that respectable place" << endl;

cin >> PlacementHandler;

switch (PlacementHandler)
{
case '1':
*(ptr + 0) = 'x';
break;
case '2':
*(ptr + 1) = 'x';
break;
case '3':
*(ptr + 2) = 'x';
break;
case '4':
*(ptr + 3) = 'x';
break;
case '5':
*(ptr + 4) = 'x';
break;
case '6':
*(ptr + 5) = 'x';
break;
case '7':
*(ptr + 6) = 'x';
break;
case '8':
*(ptr + 7) = 'x';
break;
case '9':
*(ptr + 8) = 'x';
break;
}

cout << Placement[0] << Placement[1] << Placement[2] << endl
<< Placement[3] << Placement[4] << Placement[5] <<
endl << Placement[6] << Placement[7] << Placement[8] << endl;

}

system("PAUSE");
return 0;
}
closed account (E0p9LyTq)
PLEASE learn to use code tags. It makes reading and commenting on your source code MUCH easier.

http://www.cplusplus.com/articles/jEywvCM9/

Hint, you can edit your posts and add code tags.
Topic archived. No new replies allowed.