Can't get my code to compile

Hi there I dont suppose anyones got anytime to just to go through my code and spot any mistakes, im trying to get it to compile but its not working, the idea behind this assignment is that its a 3 X 3 guessing grid and the user has to guess what behind the grid.
Thanks

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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#include<iostream>
#include<conio.h>
#include<string>
#include<cstdlib>
#include<ctime>

using namespace std;

int pause()						//Funtion for pause
{
	int in;
	scanf("%c",&ch);			
	getint();					
	return 0;
}

int main ()
{
   int Go= 1, numbers_ctr=0; 
   
	cout<< "Welcome to Guess Game" <<endl;
//I'm inserting a message so that when the game loads the user will be welcomed into the game.


//This is the Character Array	
 char coveredarray [3][3] =      {{'?','?','?'},	                          
                                {'?','?','?'},
                                {'?','?','?'}};
                                
                                
    for(int row = 0; row < 3; row++)
    {
        for(int column = 0; column < 3; column++)
        {
            cout << coveredarray[row][column] << " ";

		}
            cout << endl;
        }
//This is the Guess Array

	int randarray[3][3] = {{0,0,0},
	                       {0,0,0},
	                       {0,0,0}};

    srand(unsigned time(0));
    
    int randarray[3][3] = rand()%9 + 1;
    
    for(int row = 0; row < 3; row++)
	{
          { for(int column = 0; column < 3; column++)
               { cout <<  randarray[row][column];
	}
}

}
	int playarray[3][3]; 

	 int row, column;
	 int turn= 1, mine_ctr=0; 
	 int play_row, play_column;

int row , column;  // Spelling of column is incorrect 
cout << "Please enter the row to enter a number between 1-3 " << endl;
cin >> row;

if (playarray[column] [row] != 0 )

{
	playarray[row][column] = 0 ; 
//If you get the number wrong then it will appear as a 0
	{
cout<<endl;
cout<< "Go"<<endl;
cout<< "Wrong number:"<<numbers_ctr<<" "<<"Please enter another number"<< <<endl;
}
while (Go < 21) 
{
cout<<endl;
cout<< "Go"<<endl;
cout<< "Numbers found:"<<numbers_ctr<<" "<<"Numbers yet to be found:"<<10 - numbers_ctr<<endl;
}

if((play_row < 1) || (play_row > 3))
{
cout<<endl;
cout<< "Go"<<endl;
cout<< "Remember, choose between 1 - 3"<<endl;
 //This will stop the user entering numbers larger than the grid
system("pause");
continue;
{

if((play_column < 1) || (play_column > 3)
{
cout<<endl;
cout<< "Go"<<endl;
cout << "Please enter the column to enter a number between 1-3" << endl;
cin >> column;
{

if (playarray[column] [row] =<9)
{
cout<<endl;
cout<< "Go"<<endl;
cout<< "Remember, choose between 1 - 9"<<endl; 
//This will stop the user entering numbers larger than the grid
system("pause");
continue;
{


cin >> num[row-1][column-1];
}

{
if (randarray[row][column] =<9) ;
 // The number will change if you get the right answer
{
cout<< "Go"<<endl;
cout<<"Please enter a number between 1-9 "<<endl; cout<< "Number Found"<<endl;
playarray[play_row-1][play_column-1] = ; 
numbers_ctr++;
for (int row=0; row<3; row++)
{
for(int column=0; column<3; column++)
{
cout<<playarray[row][column]<<" ";
}
cout<<endl;

}

else
//This will show an F to show the flagged area the user has been before
{
cout<<" Please Try again "<<endl;
playarray[play_row-1][play_column-1] = 0;
}
for(int row=0; row <3; row++)
}
for(int column=0; column<3; column++)
{
cout<<playarray[row][column]<<" ";
}
cout<<endl;

{
} while (Go < 21) 
{

cout<<endl;
cout<< "Numbers found:"<<numbers_ctr<<" "<<"Numbers yet to be found:"<<10 - numbers_ctr<<endl;
numbers_ctr<<endl;

{
if (playarray[column] [row] != 0 )
{
cout<<endl;
cout<< "Go"<<endl;
cout<<" Wrong Number "<<endl;:"<<numbers_ctr<< << "Please enter another number" << <<endl;

playarray[play_row-1][play_column-1] = 'F';

for(int row=0; row <3; row++)

{
for(int column=0; column<3; column++)
{
cout<<playarray[row][column]<<" ";
}
cout<<endl;



if(playarray[play_row-1][play_column-1] == 1)

{
cout<< "Go"<<endl;
cout<<" That position has already been selected please choose another row and column "<<endl;
system("pause");
continue;
}
array[play_row-1][play_column-1]=1;


if(numbers_ctr == 9)

{
cout<<" You have won "<<endl;
break;
}

Go++;


}   
} 
if(Go==21)

{
cout<<" You have reached your number of goes. "<<endl;
}

_getch();


}

 
Last edited on
It usually helps if you give what compile errors you're getting
It says unable start program :(
This line is way messed up:


out<<" Wrong Number "<<endl;:"<<numbers_ctr<< << "Please enter another number" << <<endl;

line:162

I am pretty sure you didnt return 0 either
Last edited on
yup superdude is right 162 is out for kill.. and yes he didn't return zero
closed account (jwkNwA7f)
Yeah.
Line 162:
out<<" Wrong Number "<<endl;:"<<numbers_ctr<< << "Please enter another number" << <<endl;
Should be:
cout<<" Wrong Number "<<endl<<numbers_ctr<< "Please enter another number" <<endl;
Hope this helped!
Topic archived. No new replies allowed.