I realized after sending this message that i was using the wrong  
compiler from habit
On Aug 7, 2008, at 6:31 PM, Paul David wrote:

> i have no idea what to do. it wont compile on my mac. WHAT AM I DOING
> WRONG!
>
> here is the code it is in C++:
>
> #include <iostream>
> #include <ctime>
> using namespace std;
> int printboard();
>
> char board[8][8] = { {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',}, {' ',
> ' ', ' ', ' ', ' ', ' ', ' ', ' ',}, {' ', ' ', ' ', ' ', ' ', ' ', '
> ', ' ',}, {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',}, {' ', ' ', ' ', '
> ', ' ', ' ', ' ', ' ',}, {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',}, {'
> ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',}, {' ', ' ', ' ', ' ', ' ', ' ',
> ' ', ' ',}, };
>
> int main()
> {
> srand(time(NULL));
> int pos1 = rand()%8;
> int pos2 = rand()%8;
> int pos3 = rand()%8;
> int pos4 = rand()%8;
> int loop = 1;
> char move;
> board[pos1][pos2] = '@';
> board[pos3][pos4] = 'O';
> while(loop=1)
> {
> printboard();
> cout << endl << endl << "use W,A,S,D to move or Q to quit: ";
> cin >> move;
> if((move == 'w') || (move == 'W'))
> {
> board[pos3][pos4] = ' ';
> pos4--;
> board[pos3][pos4] = 'O';
> printboard();
> cout << endl << endl;
> }
> if((move == 'a') || (move == 'A'))
> {
> board[pos3][pos4] = ' ';
> pos3--;
> board[pos3][pos4] = 'O';
> printboard();
> cout << endl << endl;
> }
> if((move == 's') || (move == 'S'))
> {
> board[pos3][pos4] = ' ';
> pos4++;
> board[pos3][pos4] = 'O';
> printboard();
> cout << endl << endl;
> }
> if((move == 'd') || (move == 'D'))
> {
> board[pos3][pos4] = ' ';
> pos3++;
> board[pos3][pos4] = 'O';
> printboard();
> cout << endl << endl;
> }
> if((move == 'q') || (move == 'Q'))
> {
> break;
> }
> if((board[pos1][pos2] == ' ') || (board[pos1][pos2] == 'O'))
> {
> system("clear");
> while(loop <= 1500)
> {
> cout << "YouWin! ";
> loop++;
> }
> system("sleep 3");
> break;
> }
> if((move != 'w') && (move != 'W') && (move != 'a') && (move != 'A')
> && (move != 's') && (move != 'S') && (move != 'd') && (move != 'D') &&
> (move != 'q') && (move != 'Q'))
> {
> cout << "enter W,A,S,D,Q" << endl;
> system("sleep 3");
> system("clear");
> printboard();
> cout << endl << endl;
> }
> }
> }
> int printboard()
> {
> system("clear");
> cout << "_" << "." << "_______" << "." << "_____" << "." << "_____"
> << "." << "_____" << "." << "_____" << "." << "_____" << "." <<
> "_____" << "." << "_____" << "._\n";
> for(int i = 0;i < 8; i++)
> {
> cout << "_" << "| " << board[0][i] << " | " << board[1][i] << "
> | " << board[2][i] << " | " << board[3][i] << " | " << board[4]
> [i] << " | " << board[5][i] << " | " << board[6][i] << " | " <<
> board[7][i] << " |_\n";
> cout << "_" << "|" << "_______" << "|" << "_____" << "|" << "_____"
> << "|" << "_____" << "|" << "_____" << "|" << "_____" << "|" <<
> "_____" << "|" << "_____" << "|_\n";
> }
> }
>
> [Non-text portions of this message have been removed]
>
>
> 



[Non-text portions of this message have been removed]

Reply via email to