I am very new to C so this may seem a silly question.
I've got a simple application where I have the user enter a unit price for an inventory part. I need to validate that the user has entered a numeric answer before I let them save it to a binary file. I've got the variable defined as a double. It looks something like this:
double price;
printf("Enter unit price for the part: "
scanf("%lf", &price);
I need to flag the user if they've entered something like
34m.50 or any other non numeric character.
Any help would be greatly appreciated.
I've got a simple application where I have the user enter a unit price for an inventory part. I need to validate that the user has entered a numeric answer before I let them save it to a binary file. I've got the variable defined as a double. It looks something like this:
double price;
printf("Enter unit price for the part: "
scanf("%lf", &price);
I need to flag the user if they've entered something like
34m.50 or any other non numeric character.
Any help would be greatly appreciated.