char input[32];
char name[32];
char discountUser[32];//not sure to using about arrays.
char notDiscountUser[32];//not sure to using about arrays.
int i,j;
int len;
fgets(input,32,stdin);
sscanf(input,"%s",name);
len = strlen(name);
for(i=0,j=0; i < len; i++)
{
if(isdigit(name[i]))
{
digits[j] = name[i];
if (digits[j] > 48)
{
strcpy(discountUser[i],name); //i want to stored the name at i index
printf("you have discount code\n");
}
else if (digits[j] <= 48)
{
strcpy(notDiscountUser[i],name); //i want to stored the name at i index
printf("you don't have discount code\n");
}
j++ ;
}
}
I need to separate user who have discountcode or not by enter 3charofname and 1 digit eg. cat2 if digit more than 0 so, the user have discount if digit is 0 so, they not have discount example i have cat0 bee1 ear2 eye0 when i print notdiscount : cat0 , eye0 discount : bee1 , ear2
i check digit by isdigit and i have problem with copy username by strcpy . Thanks for help . :]