FireNet 64 Posting Whiz in Training

It's easy once you get to know the windows message handling
[I will assume you checked out http://www.winprog.org/tutorial/ it's good]

Hey read everything and if you need more come back here..

You cant compile GUI like dos, you will have to change some options in your compiler or you will get an error on make like:

WinMain() not referneced ..... bla...bla or someting like that

FireNet 64 Posting Whiz in Training

You seem to have a funny problem eh,well once you really have file handling in your hands you will look back and laugh.

Ok first the rand() does not return any random numbers but ones form a array so you must use the srand(...) to seed the array..

Now to file handling.
You use c++ so I assume you use fstream.Ok now rather than reading 7 lines of chars from the file use dynamic file access on a binary file.

To open a file in binary mode

file.open("name_of_file",ios::in|ios::out|ios::binary);

Dynamic File Acess Funtions.(They move the file pointer in bytes)

file.seeg();
file.seekp();

Hey you might already know this so wont go into detail(If you dont just post an i'll explain)

ok now store diffrent menu items is a structure like:

struct menu
{
    char name[100];
    char whatever;
    int whatever;
}

This will enable us to use dynamic access easily as all the structure variables are of the same size.To find the size of any data type.

cout<<sizeof(data_type);//size in bytes

So if you use structures the size if always the same.So if struct is 5 100 bytes in size the first record will start at byte zero,second on byte hundred and so on.So this can be used to calculate the location fo the data and move the pointer there.Use the following formula.[The 1st rec is 0 not 1,similar to arrays]

file.seekg(rec_no*sizeof(strcture),ios::beg);
file.read((char*)&var,sizeof(strcture)); //to read

/*file.write((char*)&var,sizeof(strcture));//to write */

Now you can dynamically read,write,and modify.[Modification …

FireNet 64 Posting Whiz in Training

Looki,Looki

I havent done a c++ tic-tac-toe yet,so I can only give some ideas.

Game Screen
[1][2][3]
[4][5][6]
[7][8][9]

You said it was 3x3 array.Dumping the user's need to enter a x,y loc would be a good idea.Just let them enter the single numbers like above and calculate the x,y loc internaly like:

int loc(int &x,int &y)
{
      int num,temp;

      if(num > 0 && num <10)
      {
         if(num<= 3)
         {
            x=0;
         }
        else if(num <= 6)
        {
             x=1;
        }
        else 
        {
            x=2;
        }

       if(num==1||num==4||num==7)y=0;
       else if(num==2||num==5||num==8)y=1;
       else if(num==3||num==6||num==9)y=2;
     return(0)
    }
    else
    {
         return(-1);
    }
}

ok a good bit of code but you should be able to put it into the code you have without major changes and you get an x and y coordinate without having to bother the users.It return -1 an in valid move is made and 0 if correct;

Call this funtion where you let the user enter the x,y and assign the values accordingly.

void TicTacToe:: get_player1_move(int &, int &)
{ //something
}

& is the refference operator which means it will take the memory address of the variable you pass to it instead of copying it.So any changes you make to a refferenced variable would change the value of the orginal variable(i.e the varible you use to call the funtion with).See below if you still have not got it.

void norm_fun(int x)
{
     x+=10;
        cout<<"\nn X="<<x;
}

void ref_fun(int &x)
{
   x+=10;
   cout<<"\nr X="<<x; …