3. Create a program that allows a user to enter up to five names
of friends. Use a two-dimensional array to store the friends’
names. After each name is entered, the user should have the
option to enter another name or print out a report that shows
each name entered thus far.
I have some code that I posted on here a long time ago its a close thread now anyway I'm just wondering how to print out say 5 names first and last here's the old code
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i = 0;
char *iName[2][15] = {'\0'};
int iChoice = 0;
while(iChoice != 3)
{
system("cls");
printf("\n1\tEnter a name");
printf("\n2\tPrint Report");
printf("\n3\tQuit");
printf("\n\n\tEnter a Choice: ");
scanf("%d", &iChoice);
if(iChoice == 1)
{
system("cls");
printf("\n\tEnter a name: ");
scanf("%s %s", iName[0],iName[1]);
}
else if(iChoice ==2)
{
system("cls");
for (i = 0; i <= 3; i++)
printf("%s %s\n",iName[i],iName[i]);
break;
}
}
system("Pause");
return (0);
}