#include <stdio.h>
#include <conio.h>
#define MAX 25
char welcomeMsg[]="Please enter your name without * or #";
char errorMsg[]="Error, please try again";
void main(void)
{
int j;
char name[MAX],input;
j=0;
printf("%s\n", welcomeMsg);
do
{
gets_s(name,24);
if(name[j]=='#'|| name[j]=='*')
{
printf("%s\n", errorMsg);
j=0;
continue;
}
name[j]=name[j]+j;
j++;
}while(name[j]<25&&name[j]!='\n');
name[j]=0;NULL;
puts("\nYour Name is");
printf("%s",name);
}
not sure when programs runs, only 1st chracter of string is displayed :( It's my first time doing strings and I'm quite new to c++ so i desperately need help on what is actually wrong. Why isn't my string displaying as a whole? Only 1 character displayed.