Thread: attaching a char to each object

  1. #1
    Registered User
    Join Date
    Apr 2012

    attaching a char to each object

    hi im trying to make a game in c++,i have an array of object however i m facing a problem to see which player is playing. i need to attach a value to each object such as 'w' can some tell me what this is called and what should i do im, new to c++ programing any help is really appriciated as im stuck here

  2. #2
    Registered User
    Join Date
    Apr 2013
    Post a code of that game, it's difficult to understand what is your problem.

  3. #3
    Registered User
    Join Date
    Apr 2012
    Cboard::Cboard(){	 for (int i = 0; i < 8; ++i) {
    			for (int j = 0; j < 8; ++j) {
    				(*ppiece).board[i][j] = NULL;
    	 for (int j = 0; j < 8; ++j) {
    	(*ppiece).board[1][j] = new Cponn;
    	 //(*ppiece).board[2][3] = new cknight; 
     char Cboard::check(int i , int j ){
    	 char yo = NULL;
    	 if((*ppiece).board[i][j] != NULL){
    	 if((*ppiece).board[i][j]->getpiece() == 'p'){
    		 std::cout<<"p ";
    		 yo =1;
    	 if((*ppiece).board[i][j]->getpiece() == 'N'){
    		 std::cout<<"n ";
    	 return yo;
    near new cponn i need to add the colour of the palyer

  4. #4
    Join Date
    Oct 2007
    Inside my computer
    I have a feeling you are learning from an outdated book or have been taught very bad things. Can you post the complete source?
    Your indentation is failing, too. You should fix that.
    Then stop using new. You don't need it.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 08-11-2010, 12:42 PM
  2. Attaching Cylinder to Bezier curve...
    By MipZhaP in forum Game Programming
    Replies: 5
    Last Post: 09-02-2004, 10:09 AM
  3. Attaching functions to a class/struct
    By VirtualAce in forum Tech Board
    Replies: 2
    Last Post: 08-04-2003, 10:56 AM
  4. attaching a vcr or other tv device to a computer
    By eats only heads in forum Tech Board
    Replies: 12
    Last Post: 12-08-2002, 01:57 PM
  5. attaching multiple files
    By smd in forum C++ Programming
    Replies: 1
    Last Post: 07-17-2002, 07:25 AM