Hello. I have the matrix below (3x3)which contains 9 names. How can I change one row in this matrix using a loop and set all names (of that row) to Pete? Thanks for any help.
string **firstArray = new string*[3];
for (int i = 0; i < 3; i++)
{ firstArray[i] = new string[3];}
#include <string>
using std::string;
int main (int argc, char* argv[])
{
string** firstArray = new string*[3];
for (int i=0; i<3; i++)
{
firstArray[i] = new string[3];
}
int i = 1; // this is the row you want to change, in this example the 2nd row
string name = "Pete";
for (int j=0; j<3; j++)
{
firstArray[i][j] = name;
}
return 0;
}