[Beginner] A problem outputting array elements

Hello there,
So I've been into learning C++ for a long time, and I finally started. So I was working on this Tic Tac Toe CLI game, and I faced a problem. Here is the whole code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

string Player_Symb, Comp_Symb;
string feild[9]= {"1", "2", "3", "4", "5", "6", "7", "8", "9"};


int play(){  
    system("cls");  
    cout << "_____________" << endl;
    cout << "| " << feild[0] << " | " << field[1] << " | " << feild[2] << " |" << endl;
    cout << "-------------" << endl;
    cout << "| " << feild[3] << " | " << field[4] << " | " << feild[5] << " |" << endl;
    cout << "-------------" << endl;
    cout << "| " << feild[6] << " | " << field[7] << " | " << feild[8] << " |" << endl;
    cout << "-------------" << endl;
    system("pause");
    return 1;
}

int intro(){
    
    cout << "Welcome to A-Tic Tac Toes" << endl << "Do you want to be \"x\" or \"o\": ";
    cin  >> Player_Symb;
    while (Player_Symb != "x" && Player_Symb != "o"){
          cout << endl << "Input error: Your input has to be either \"x\" or \"o\": ";
          cin  >> Player_Symb;
          }
    if (Player_Symb == "x"){
                    Comp_Symb = "o";
                    }
    else{
         Comp_Symb = "x";
         }
    play();
    return 1;
}

int main(){
    intro();
    return 1;
}

I get an error code at line 14 saying: 'field' undeclared (first use this function). I did some testing regarding this and apparently (not sure), I can only output a field array element once in each function!! And when I try to output another element of that array again, I will get that error. Is it really like that? Any help is greatly appreciated.

P.S: I do have a previous background on programming (2 years of Python and a little bit of PHP, ASM and the so called programming language, HTML). So don't hesitate in using these technical vocabulary words.

Also, since I am asking now, can anyone please tell me what does cstdlib do?

Thanks in advance!
on line 8 you declared the array "feild".

you never declared anything named "field". is that what you mean?

string feild[9]= {"1", "2", "3", "4", "5", "6", "7", "8", "9"};
So don't hesitate in using these technical vocabulary words.


spell check

haha sorry couldn't resist

!To error is human, to really screw up, requires a computer.
@SamuelAdams: lol yeah!

Actually, thats not what i meant. I am trying to input each array element in its box. But it fails in array element [1] showing that error.
Topic archived. No new replies allowed.