Tuesday, July 14, 2009

Filling a 2d array in C++?

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;


}











}

pansy

1 comment:

  1. how to stop the c++ 2D arrary with end of -1.......
    and how to put .00 at the back of the number for the ouput only

    fast.....urgent

    ReplyDelete