Hello,
I need to write a program to take in a name (max 101 characters) and out store in into an array so that I can output it like a list. These 2 programs are apart of a bigger program that keeps asking if you want to add another name to the array but I can't seem to get the rows and colums matched in the program. I guess what I am trying to say is I can't make the output stop at the NULL character in the array. I need the output to say:
Current List:
Mark
Steve
John
but right now its something like
J
O
it doesn't aknowledge the previous names
char Append(char List[MAX_ROWS][MAX_NAME_LENGTH], int NumUsed)
{
char item[101];
for ( int i = 0; i <= 1; i++)
{
cout << "Append: ";
cin.getline(item, 101);
strcpy(List[i], item);
NumUsed++;
}
system("CLS");
}
char Show(char List[MAX_ROWS][MAX_NAME_LENGTH], int NumUsed)
{
cout << "*************\n"
<< "Current List [0/" << NumUsed << "]:" << endl;
for ( int i = 0; i <= NumUsed; i++ )
{
for ( int j = 0; j <= NumUsed; j++ )
{
cout << List[i][j];
}
}
cout << "\n*************" << endl;
}