assinging strings to two dimensional array

From: Reginald Carlier (reginald.carlier_at_pandora.be)
Date: 06/10/04


Date: Thu, 10 Jun 2004 13:12:21 GMT

Hi,

I'm programming a game and one of the variables is a two dimensional
array in wich I store the names of the players. So far so good; with
cin.get I ask the names of the players and everything works fine.
Now I want the player also to be able to play against the computer and
I don't want him to fill in the name "computer" interactively; I want to
 set the second element of the two-dimensional array to computer.
When i do
player[2][30];
player[1]="computer";
I get an error that the compiler can not convert from a char[9] type to
a char[30] type wich I can understand.
but when i do
player[1][0]={'c'}; the comiler complains of missing ;

Does anyone know how to solve this problem?
The goal is to get a two dimensional array containing the name of the
first player in the first array. (this is done with cin.get(player[0],max);)
In the second I want to store the name computer.

Reginald



Relevant Pages

  • Re: Finding the nearest match without reusing results
    ... comparing an array with a value generates an array of Trues and ... Any diff with wrong State or with used Store is implicitly zeroed out. ... Each must be larger than the absolute value of the maximum Sales ... go.....it just needs to return the closest match. ...
    (microsoft.public.excel.programming)
  • Re: read keyboard input and storing in an array?
    ... > I'm trying to store user input in an array, ... You have the beginnings of that logic already since your prompt tells the ... 201st value since the array only has room for 200 values. ... This will force you to store the int values as Integer ('Integer' ...
    (comp.lang.java.help)
  • Re: Challenge: reading ascii data
    ... to store all the data before producing any output. ... would be bad practice in terms of memory consumption to use a standard ... So I use hashes to create a two-level "sparse array", ... Well the original problem definition was: ...
    (comp.lang.fortran)
  • Re: attempting an actual game...
    ... >>> and inflexible by the absurd decision to use a bit array for square ... as then one has 8 bits in which to store a color and a few flags ... Using a 2D int (or, ... > Change direction and you may eventually complete a game. ...
    (comp.games.development.programming.misc)
  • Re: Sparse arrays
    ... >access array element, set it, sit for a bit, and read it back ... ONLY operations are STORE and RETRIEVE with no structure to the ... If you can tolerate a bit of inefficiency ... They live in sorted lists. ...
    (comp.lang.fortran)