Validating input in c dating who should pay

Posted by / 16-Nov-2019 10:28

Once they select the number, 1 for Euro, 2 for Deutsche Mark etc, it will prompt you for how many US dollars you want to convert to your selected currency.After entering a dollar number 0, it will do the conversion and display it for you.

The link below has what I have so far and now when I put a character say 'f' when it asks me for a selection number, it asks me again for a selection # (meaning that i inputted a wrong data type). During the step for selecting what currency you want to convert to and when entering the amount of use dollars, they have to be certain data types. If it is anything else they will go thru a loop and be prompted again to give a selection number (1-5). From the C FAQ: 12.26a: How can I flush pending input so that a user's typeahead isn't read at the next prompt? They will then be prompted for which selection they want to enter (which can only be 1-5, no characters or anything like it).The only thing is though that when I enter a 1 to select Euro the app does absolutely nothing. If you allow scientific notation, you will also need to check for 'e', 'E', 'd' and 'D'.Since it is currency, I would suggest that you can assume fixed point format. Reading the currency value into your program as an integer is a bad idea.The only thing is though that when I enter a 1 to select Euro the app does absolutely nothing. My problem has been is validating user input and how to go about it. Stepping through a program can be a very educational way of learning how to create good logic. In reality this could be written with only one printf and one scanf (and no getchar()) - place the prompting string and the input function inside a while loop that will iterate the loop when a flag variable is true (or false) depending upon whether you prefer testing positive or negative conditions...During the step for selecting what currency you want to convert to and when entering the amount of use dollars, they have to be certain data types. If it is anything else they will go thru a loop and be prompted again to give a selection number (1-5). the trick is to initialize the flag to force the loop to be entered the first time...

validating input in c-16validating input in c-24validating input in c-78