print names instead of numbers in multidimensional arrays

0 musa aliyu · May 8, 2015
I've tried writing names instead of numbers,can someone help me please.I tried all the ways I can but it shows me an error.
I want it to be like this

petter jackson
musa aliyu
Antonia romaker

thank you all,bucky in particular 

Post a Reply

Replies

Oldest  Newest  Rating
+1 Sharon Fabin · May 8, 2015
int main(){
string names[3][2];
names[0][0] = "petter";
names[0][1] = "jackson";
names[1][0] = "musa";
names[1][1] = "alyio";
names[2][0] = "Antonia";
names[2][1] = "romaker";
for (int i = 0; i < 3; i++){
for (int j = 0; j < 2; j++){
cout << names[j] << " ";
}
cout << endl;
}
return 0;
}
  • 1

C++

107,247 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator