Greetings everyone,
I cannot seem to output an array of strings after inputting it.
The user should input Names in each cell and then the names should be outputted.
The output should give the inputted Name as well as the Points. I've done it with Points, but the names I cannot output.
Code:
char name[15];
int cnum;
int points[15];
int cont;
int i;
cnum=0;
for (i=0; i<15; i++)
{
cnum++;
printf("1. ");
printf("Insert the name of contest number %i : ", i+1);
scanf("%s", &name[i]);
printf("3. ");
printf("Insert points [between 0 e 100]: ");
scanf("%d", &points[i]);
printf("Continue for other participants? 1=yes, 0=no:\n");
scanf("%d", &cont);
{
if(cont==0)
break;
}
}
for(i=0; i<cnum; i++)
{
printf("Contestant numb %i info:\n Points %i\n Name %s\n", i+1, points[i], name);
}
Any help would be appreciated.