Hi guys
I am still stuck with my program...I've let it sit for a while and then worked on it again but I cant figure this out
the program is working fine but I need all the questions appearing at the same time and as user input the answers, show only the questions that have not been answered yet
I've tried to change the while condition at the end but it does not make any difference...
any hints on how to accomplish it?
(my problem originally was that "chocolate" could be a choice for either icecreamFlavor and sauceFlavor, but if the user picks chocolate and no other answers have been selected then "chocolate" should be assigned to icecreamFlavor first - Bazzy suggested to split it in three separate functions, but the purpose of the program is to show the questions until a certain condition is met)
I think that you should use if..elseif..elseif at the top so that you are only asking one question at a time. There are too many corner cases to contend with. What if the user answers all three questions at the same time? How is the user supposed to know how to answer the questions when three questions are posed at the same time? You have to have a flag that keeps track of which question was asked so that you know which order you are filling and then continue to loop until all 3 questions have been asked and answered.
Currently, there are too many ways in which a user could screw up the program without having any idea why it isn't working.
Get a sheet of paper and write down the steps that you want to be performed in order. Pencil it around for a while until you are satisfied. Then, write the code. The organization of your program makes little sense and if you step through it you'll see why.
(The "else if" was suggested in the previous thread.) We cannot just tell you how YOUR program should work... Maybe you could provide a number of test cases where you give it a particular set of inputs and explain the expected results. Engineering software is a process, not just a single step.
Here is an example of how *I* think it should work:
1. ask for flavor
2. accept flavor from the user
3. validate flavor and either continue or alert the user and go back to step 1
4. ask for next thing
5. accept next thing from user
6. validate next thing and either continue or alert the user and go back to step 4