Hiya.
I'm a complete C++ noob. I'm trying to make a bingo game where the computer gives the user eight numbers and the user slowly plays a game of bingo.
It's very much work in progress.
However, I'm having a problem when trying to compile it, the program seems to be confused by the inclusion of 'do' in the middle of a statement. This is on line 64. Another two error messages I'm receiving is that my syntax is incorrect on lines 74 and 78 with regards to the boolean variables. Anyway, and help would be greatly appreciated.
Thanks.
#include <iostream>
#include <ctime>
void main() {
using namespace std;
time_t t;
time(&t);
srand(t);
// Initialising the eight choices.
int iChoice1;
int iChoice2;
int iChoice3;
int iChoice4;
int iChoice5;
int iChoice6;
int iChoice7;
int iChoice8;
int iGoodNumber;
char cMark = 'X';
bool bGameOver; false;
bool bGoodNumber; false;
iChoice1 = (rand() % 9);
iChoice2 = (rand() % 9);
iChoice3 = (rand() % 9);
iChoice4 = (rand() % 9);
iChoice5 = (rand() % 9);
iChoice6 = (rand() % 9);
iChoice7 = (rand() % 9);
iChoice8 = (rand() % 9);
if (iChoice1 == 0 || iChoice2 == 0 || iChoice3 == 0 || iChoice4 == 0 || iChoice5 == 0 || iChoice6 == 0 || iChoice7 == 0 || iChoice8 == 0) {
iChoice1 = (rand() % 9);
iChoice2 = (rand() % 9);
iChoice3 = (rand() % 9);
iChoice4 = (rand() % 9);
iChoice5 = (rand() % 9);
iChoice6 = (rand() % 9);
iChoice7 = (rand() % 9);
iChoice8 = (rand() % 9);
}
cout << "These are your numbers:\n" << endl;
cout << "|----------|----------|----------|----------|" << endl;
cout << "| | | | |" << endl;
cout << "| " << iChoice1 << " | " << iChoice2 << " | " << iChoice3 << " | " << iChoice4 << " | " << endl;
cout << "| | | | |" << endl;
cout << "|----------|----------|----------|----------|" << endl;
cout << "| | | | |" << endl;
cout << "| " << iChoice5 << " | " << iChoice6 << " | " << iChoice7 << " | " << iChoice8 << " | " << endl;
cout << "| | | | |" << endl;
cout << "|----------|----------|----------|----------|" << endl;
cout << "\nThe computer will now keep generating random \nnumbers between 1 and 8 until all of your \nnumbers have been generated.\n\n" << endl;
// Main game loop.
do {
// Wait for a number between 1 and 8 to be generated.
iGoodNumber = do {if ((rand() % 9) < 0) {
bGoodNumber = true;
}
else { bGoodNumber = false;
}
} while bGoodNumber == false;
cout << iGoodNumber << "\n" << endl;
} while bGameOver == false;
system("PAUSE");
}