array display

hi
i am new to c++ and i need some help in my programming. I dont know how to display a single character together with string on an array format as shown below.

x x x x x x
x x Ben x x x
x x x x x Chris
Sam x x x x x
x x x x x x

i have manage to get the 'x' displayed but i cant insert the string. I know that i have to assign the rows and columns position for the names but i've tried it and there is no luck.
Can someone help me how to declare the string and how to display it?

any help will be much appreciated.
thanks
1
2
3
4
5
6
7
8
9
10
#include<iostream>

int main()
{
  std::string Ben = "Ben ";
  std::cout << "x x ";
  std::cout << Ben;
  std::cout << "x x x";
  return 0;
}
Last edited on
thanks for that but is there any shortcut that you can use to assign "ben to that position in the array?
something like this expression as example but instead of the single character, i use 'ben'..

characters[2][3]='Z';

fyi, i can change the value 'x' to 'z' on where Ben is placed but i cant change it to Ben. I dont know why i cant do that.

thanks

Topic archived. No new replies allowed.