Desperately need to get this done.

can anyone please help me! I really need to get this done D':
so I can pass, comments below instruction
#include <iostream>
using namespace std;
void main()
{ //variable declaration
char answer_to_start, answer_to_questons;
int iPlayerTurn(1);
bool bGameOver(true);
int Square1('1'), Square2('2'), Square3('3'), Square4('4');
int Square5('5'), Square6('6'), Square7('7'), Square8('8');
int Square9('9'), Square10('10'), Square11('11'), Square12('12');
int Square13('13'), Square14('14'), Square15('15'), Square16('16');

cout<<"Player 1: Complete the phrase, God is ______, all the time."<<endl;
cout<<"Player 2: Compute 1000 + 400 + 30 + 4 = ______."<<endl;
}// Main game loop
do
{// Print board
cout<< Square1 << "|" << Square2 << "|" << Square3 << "|" << Square4 <<endl;
cout<< "-+-+-+-" <<endl;
cout<< Square5 << "|" << Square6 << "|" << Square7 << "|" << Square8 <<endl;
cout<< "-+-+-+-" <<endl;
cout<< Square9 << "|" << Square10 << "|" << Square11 << "|" << Square12 <<endl;
cout<< "-+-+-+-" <<endl;
cout<< Square13 << "|" << Square14 << "|" << Square15 << "|" << Square16 <<endl;
// Set player marker: Player 1 - letter and Player 2 - number
char letter;
int number;
if (iPlayerTurn == 1){
cout<< "What Letter?" <<endl;
cin>>letter;
}else
{cout<< "What Number?" <<endl;
cin>>number;}
// Prompt the player for a move
cout<< "Player" <<iPlayerTurn<<"'s move:" <<endl;
bool bValidMove;
// Loop until we get a valid move
do {
char cNextMove;
cin >> cNextMove;
bValidMove = true;
// Check for a valid move / input of player
if (cNextMove == '1' && Square1 == '1'){
Square1 = letter || number;}
else if (cNextMove == '2' && Square2 == '2'){
Square2 = letter || number;}
else if (cNextMove == '3' && Square3 == '3'){
Square3 = letter || number;}
else if (cNextMove == '4' && Square4 == '4'){
Square4 = letter || number;}
else if (cNextMove == '5' && Square5 == '5'){
Square5 = letter || number;}
else if (cNextMove == '6' && Square6 == '6'){
Square6 = letter || number;
} else if (cNextMove == '7' && Square7 == '7'){
Square7 = letter || number;
} else if (cNextMove == '8' && Square8 == '8'){
Square8 = letter || number;
} else if (cNextMove == '9' && Square9 == '9'){
Square9 = letter || number;
} else if (cNextMove == '10' && Square10 == '10'){
Square10 = letter || number;
} else if (cNextMove == '11' && Square11 == '11'){
Square11 = letter || number;
} else if (cNextMove == '12' && Square12 == '12'){
Square12 = letter || number;
} else if (cNextMove == '13' && Square9 == '13'){
Square13 = letter || number;
} else if (cNextMove == '14' && Square9 == '14'){
Square14 = letter || number;
} else if (cNextMove == '15' && Square9 == '15'){
Square15 = letter || number;
} else if (cNextMove == '16' && Square9 == '16'){
Square16 = letter || number;
} else{
cout <<"Invalid Move. Try again."<<endl;
bValidMove = false;}}
while (!bValidMove);
bGameOver = false;
bool bWinGame = true;
// Check for end of game conditions
if (Square1 != '1') {
if (Square1 == 'g' && Square2 == 'o' && Square3 == 'o' && Square4== 'd' ||
Square1 == '1' && Square2 == '4' && Square3 == '4' && Square4== '3') {
bGameOver = true;}
if (Square1 == 'g' && Square5 == 'o' && Square9 == 'o' && Square13 =='d' ||
Square1 == '1' && Square5 == '4' && Square9 == '4' && Square13== '3'){
bGameOver = true;}
if (Square1 == 'g' && Square6 == 'o' && Square11 == 'o' && Square16 =='d' ||
Square1 == '1' && Square6 == '4' && Square11 == '4' && Square16== '3'){
bGameOver = true;}
if (Square4 == 'g' && Square3 == 'o' && Square2 == 'o' && Square1== 'd' ||
Square4 == '1' && Square3 == '4' && Square2 == '4' && Square1== '3'){
bGameOver = true;}
if (Square13 == 'g' && Square9 == 'o' && Square5 == 'o' && Square1 =='d' ||
Square13 == '1' && Square9 == '4' && Square5 == '4' && Square1 == '3'){
bGameOver = true;}
if (Square16 == 'g' && Square11 == 'o' && Square6 == 'o' && Square1 =='d' ||
Square16 == '1' && Square11 == '4' && Square6 == '4' && Square1 == '3'){
bGameOver = true;}}
if (Square2 != '2') {
if (Square2 == 'g' && Square6 == 'o' && Square10 == 'o' && Square14 == 'd' ||
Square2 == '1' && Square6 == '4' && Square10 == '4' && Square14 == '3'){
bGameOver = true;}
if (Square14 == 'g' && Square10 == 'o' && Square6 == 'o' && Square2 == 'd' ||
Square14 == '1' && Square10 == '4' && Square6 == '4' && Square2 == '3'){
bGameOver = true;}}
if (Square3 != '3') {
if (Square3 == 'g' && Square7 == 'o' && Square11 == 'o' && Square15 == 'd' ||
Square3 == '1' && Square7 == '4' && Square11 == '4' && Square15 == '3'){
bGameOver = true;}
if (Square15 == 'g' && Square11 == 'o' && Square7 == 'o' && Square3 == 'd' ||
Square15 == '1' && Square11 == '4' && Square7 == '4' && Square3== '3'){
bGameOver = true;}}
if (Square4 != '4') {
if (Square4 == 'g' && Square8 == 'o' && Square12 == 'o' && Square16 == 'd' ||
Square4 == '1' && Square8 == '4' && Square12 == '4' && Square16== '3'){
bGameOver = true;}
if (Square16 == 'g' && Square12 == 'o' && Square8 == 'o' && Square4 == 'd' ||
Square16 == '1' && Square12 == '4' && Square8 == '4' && Square4 == '3'){
bGameOver = true;}
if (Square4 == 'g' && Square7 == 'o' && Square10 == 'o' && Square13 == 'd' ||
Square4 == '1' && Square7 == '4' && Square10 == '4' && Square13 == '3'){
bGameOver = true;}
if (Square13 == 'g'&& Square10 == 'o' && Square7 == 'o' && Square4 =='d' ||
Square13 == '1' && Square10 == '4' && Square7 == '4' && Square4== '3'){
bGameOver = true;}}
if (Square5 != '5') {
if (Square5 == 'g' && Square6 == 'o' && Square7 == 'o' && Square8 == 'd') {
bGameOver = true;}
if (Square5 == '1' && Square6 == '4' && Square7 == '4' && Square8 == '3') {
bGameOver = true;}
if (Square8 == 'g' && Square7 == 'o' && Square6 == 'o' && Square5 == 'd') {
bGameOver = true;}
if (Square8 == '1' && Square7 == '4' && Square6 == '4' && Square5 == '3') {
bGameOver = true;}}
if (Square9 != '9') {
if (Square9 == 'g' && Square10 == 'o' && Square11 == 'o' && Square12 == 'd') {
bGameOver = true;}
if (Square9 == '1' && Square10 == '4' && Square11 == '4' && Square12 == '3') {
bGameOver = true;}
if (Square12 == 'g' && Square11 == 'o' && Square10 == 'o' && Square9 == 'd') {
bGameOver = true;}
if (Square12 == '1' && Square11 == '4' && Square10 == '4' && Square9 == '3') {
bGameOver = true;}}
if (Square13 != '13') {
if (Square13 == 'g' && Square14 == 'o' && Square15 == 'o' && Square16== 'd') {
bGameOver = true;}
if (Square13 == '1' && Square14 == '4' && Square15 == '4' && Square16 == '3') {
bGameOver = true;}
if (Square16 == 'g' && Square15 == 'o' && Square14 == 'o' && Square13 == 'd') {
bGameOver = true;}
if (Square16== '1' && Square15 == '4' && Square14 == '4' && Square13 == '3') {
bGameOver = true;}
// Need to check the board full (no-win condition)
if (Square1 == '1' && Square2 == '2' && Square3 == '3' && Square4 == '4' &&
Square5 == '5' && Square6 == '6' && Square7 == '7' && Square8 == '8' &&
Square9 == '9' && Square10 == '10' && Square11 == '11' && Square12 == '12' &&
Square13 == '13' && Square14 == '14' && Square15 == '15' && Square16 == '16' && !bGameOver){
bGameOver = true;
bWinGame = false;}
if (bGameOver) {
if (bWinGame) {
cout << "Player" << iPlayerTurn << " wins!" << endl;}
// Print ending board
cout<< Square1 << "|" << Square2 << "|" << Square3 << "|" << Square4 <<endl;
cout<< "-+-+-+-" <<endl;
cout<< Square5 << "|" << Square6 << "|" << Square7 << "|" << Square8 <<endl;
cout<< "-+-+-+-" <<endl;
cout<< Square9 << "|" << Square10 << "|" << Square11 << "|" << Square12 <<endl;
cout<< "-+-+-+-" <<endl;
cout<< Square13 << "|" << Square14 << "|" << Square15 << "|" << Square16 <<endl;
cout << "Game Over!" << endl;
cout << "Play again [Y/N]? " << endl;
char cPlayAgain;
cin >> cPlayAgain;
if (cPlayAgain == 'y') {
bGameOver = false;
// Clear the board
Square1 = '1';Square2 = '2';Square3 = '3';Square4 = '4';Square5 = '5';Square6 = '6';Square7 = '7';Square8 = '8';Square9 = '9';Square10 = '10';Square11 = '11';Square12 = '12';Square13 = '13';Square14 = '14';Square15 = '15';Square16 = '16';}
iPlayerTurn = 1;
} else {
// Alternate player turns
if (iPlayerTurn == 1) {
iPlayerTurn = 2;
} else {
iPlayerTurn = 1;}}}
while (!bGameOver);}
This is actually a program similar to a tic tac toe game. but instead of using 'X' and 'O', I made it to a 4 letter word and a 4 digit number. first there are 2 players, both of them will answer a question. the answer that they got will now take turns in completing in a 4 by 4 table similar to a tic tac toe example: this is somewhat the outcome..

g| | |1
-+-+-+-
|o|4|
-+-+-+-
|4|o|
-+-+-+-
| | |d

in this case playerletter wins for he/she completed the answer to the question 1st than playernumber, but just like tic tac toe they can counter each other by blocking one another.
been working on this for 2 weeks now T_T
What is the problem?
Last edited on
http://www.cplusplus.com/forum/beginner/1/
Read this before posting.

Not sure if itwas mentioned in that link, as I didn't read it, but use the woderful features of text formatting to keep any code inside' [ code] CODE GOES HERE!!! [ /code] (without whitespace) blocks. And don't be so desperate...its depressing.

Best Regards.
it say that ''unexpected end of file" as an error
Then it's reaching the end of the file, and you didn't tell it how to handle that.
what should I do then?
I have no idea. I didn't read your code, and I'm probably not going to unless you read qczackf's link.
yeah, I'm not suppose to present all the lines by I'm really not sure what to post because I dont know the problem with it hmm....
I don't know which is the error. sorry guys I'm new to this..
When you edit your post or creat a new one, there's a pallet of format tags to the rught. You need to select your code and press the code format tag.

In your code, }// Main game loop terminates main(), so the code you've posted really isn't quite right.
You need functions, the game looks like a massive block of if statements and couts, try organizing using functions and for loops.
you should put it in a while loop taht ends when player has won or lost. So just create a bool and get something to check if the game is over or not.
Topic archived. No new replies allowed.