I type this code to make a condition on user doesn't enter a string but only numbers but when enter something like this: 55ST, program accepts 55 and don't consider 55ST a string.
printf("Enter the deposit amount L.E :");
if (scanf("%lf", &money) != 1)
{
printf("Invalid input. Please enter a number.\n");
while (getchar() != '\n')
TypeTransaction = 1;
continue;
}
I need user to enter number only. When user enter something like this: 55SSYTF, I want to stop him.
scanfis not the best tool for this, you can usefgets+strtolfunctions: