I was encoding a C program as my assignment and got stuck. Following is the part of my assignment where i got stuck

Please enter the employee's pay period information :
Income for the current pay period : -2400
**Value must be greater than 0.0
**Try again. : 2400..
**Trailing character encountered
**Try again. : 2400.00

Can anybody tell me what condition I have to use here?

Recommended Answers

All 3 Replies

So what got you "stuck" ?

>>Can anybody tell me what condition I have to use here?
Sorry but I'm having trouble seeing the code on your computer. Please post on DaniWeb.

Can anybody tell me what condition I have to use here?

I see the possibility of an switch inside a do/while loop

declare an input variable and a flag variable
set a flag to false
ask the question
do
    obtain the user input
    switch input variable
         wrong input:
             display warning
             set flag false
             break
         right input:
             do this
             set flag true
             break
while flag is false repeat

Thank you very much friend. Your solution helped me alot. Thank you once again


I see the possibility of an switch inside a do/while loop

declare an input variable and a flag variable
set a flag to false
ask the question
do
    obtain the user input
    switch input variable
         wrong input:
             display warning
             set flag false
             break
         right input:
             do this
             set flag true
             break
while flag is false repeat
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.