473,473 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

TicTacToe Problems

5 New Member
Old title: Homework Due 2-20-07

can"t understand why this will not compile. I've been working on tis all week end.
Need Help desperately






Expand|Select|Wrap|Line Numbers
  1. class TicTacToe
  2. {
  3.     public:
  4.             static void newGame();
  5.  
  6.     private:
  7.  
  8.             static char board[3][3]; // priviate menbers
  9.             static char turn;
  10.             static char turn2;
  11.             static int turnRow;
  12.             static int turnCol;
  13.             static int entryCount;
  14.             static bool entryError;
  15.  
  16.  
  17. };
  18.  
  19.     int r = 0;
  20.     int c = 0;
  21.     int entryCount = 0;
  22.     char board;
  23.     void newGame()
  24.     {
  25.         system("cls");
  26.         // set turn back to 'O'
  27.         entryCount  = 0;
  28.         for(r = 0; r < 3; r++)
  29.         {
  30.             for( c = 0;c < 3; c++)
  31.             board[r][c] = ' ';
  32.         }
  33.     }
Feb 19 '07 #1
7 2192
bartonc
6,596 Recognized Expert Expert
It's probably best to post the error code/message.
Isn't main() supposed to be declared void?
Feb 20 '07 #2
Warren Hoskins
5 New Member
the error message I'm getting is in my New Game function. It telling me that row' and column are undeclared identifiers.

The main function is the only thing about the program the teacher told use not to change, but to create the rest of the program around his main.

Warren Hoskins
Feb 20 '07 #3
Ganon11
3,652 Recognized Expert Specialist
I see a few problems:

1) You probably shouldn't be declaring r and c outside of this function, as I';m not sure what use they'll be in the rest of your code.

2) You are also trying to declare board and entryCount at this point, but since they are static variables, you should be using TicTacToe:: somehow in the initialization (Not 100% on the syntax, so you'll have to look it up).

3) The function has a header of void newGame(), but it should be void TicTacToe::newGame().
Feb 20 '07 #4
AdrianH
1,251 Recognized Expert Top Contributor
If you still have problems, copy and paste the exact first two error message(s) and state what line that translates to in the function. Point at it/them with a comment(s).

We will see if we can further help you,


Adrian
Feb 20 '07 #5
AdrianH
1,251 Recognized Expert Top Contributor
It's probably best to post the error code/message.
Isn't main() supposed to be declared void?
Main should always be declared int as per ANSI-C standard. Some compilers may accept it, but it is not necessarly portable.


Adrian
Feb 20 '07 #6
denverbsd
1 New Member
You should at least offer some money if you want people to do your homework for you. :)
Feb 20 '07 #7
AdrianH
1,251 Recognized Expert Top Contributor
You should at least offer some money if you want people to do your homework for you. :)
Hey watchit wisenhower, your gonna be next. ;)


Adrian
Feb 21 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Jim Hubbard | last post by:
Are you up to speed on the difficulties in using the 1.1 .Net framework? Not if you are unaware of the 1,596 issues listed at KBAlertz (http://www.kbalertz.com/technology_3.aspx). If you are...
1
by: 3f | last post by:
Hello; We have made a web application that people can download from our web site and installed on: Windows XP Windows 2000 Professional Windows 2003 Server Windows 2000 Server
5
by: Corky | last post by:
This works: db2 SELECT DISTINCT PROBLEM_OBJECTS.PROBLEM_ID FROM PROBLEM_OBJECTS INNER JOIN PROBLEMS ON PROBLEM_OBJECTS.PROBLEM_ID = PROBLEMS.PROBLEM_ID WHERE INTEGER(DAYS(CURRENT DATE) -...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
0
by: Sergistm | last post by:
Hello World, :D I have a problem that it is making me crazy, I hope you can help me. I'm trying to execute a .exe file with the Procces.Start, and there is no problem when the file is on my...
0
by: chandniashar | last post by:
This is my perl program for tictactoe. Can anyone help me run the program as a cgi script? #!/usr/bin/perl # Description: This program implements the game of Tic Tac Toe # The grid...
9
by: wizardRahl | last post by:
Hello, I'm attempting to write a TicTacToe program for class and need some help with arrays. We have to write a program that will allow two users to play tic-tac-toe. The program needs to have...
1
by: racshah | last post by:
I have a tictactoe script with 2 users playing. I need a perl script in which one user plays with the computer. Can anyone help me with it???
0
by: Sean McIlroy | last post by:
""" AUTHOR: Sean McIlroy LANGUAGE: Python 2.5 OVERVIEW: instances of "tictactoeplayer" play optimal tictactoe SPECIALIZED TYPES: player={ex,oh}; empty={blank}; cell=player+empty; board= TYPE...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.