assinging strings to two dimensional array
From: Reginald Carlier (reginald.carlier_at_pandora.be)
Date: 06/10/04
- Next message: Rolf Magnus: "Re: OT. joke"
- Previous message: Rob Williscroft: "Re: Function returning a reference"
- Next in thread: Pete C.: "Re: assinging strings to two dimensional array"
- Reply: Pete C.: "Re: assinging strings to two dimensional array"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Rolf Magnus: "Re: OT. joke"
- Previous message: Rob Williscroft: "Re: Function returning a reference"
- Next in thread: Pete C.: "Re: assinging strings to two dimensional array"
- Reply: Pete C.: "Re: assinging strings to two dimensional array"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|