how do u fill a 2D array with 6 names where each name can have a maximum of 24 characters long. ( preferred done in a function).
Filling a 2d array in C++?
function fillArray()
{
char names[6][24];
string temp=" ";
int count=0;
count %26lt;%26lt; "Enter the intial name";
cin %26gt;%26gt; temp;
while(temp!="END")
{
for(int i=0;i%26lt;temp.length;i++)
{
names[count][i] = temp[i];
}
count++;
count %26lt;%26lt; "Enter name, enter END to stop";
cin %26gt;%26gt; temp;
}
}
garden sheds
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment