Interrupting & later completing a program
- Posted by Alex Caracatsanis <CaracatsanisA at ramsayhealth.com.au> Jul 13, 2004
- 585 views
My question is really whether it's fairly straightforward to write a program in such a a way that the user can stop before the end, save the results, then return to complete the program on another occasion - and how would I code that. For example: a diagnostic program asks the user a series of (say) 6 questions, each to be answered "Y" or "N", after which the program suggests a "diagnosis". Let's say the algorithm is: IF (ans1 is "Y") THEN (diagnosis is diag1) ELSEIF (ans2 is "Y") AND (ans3 is "N") THEN (diagnosis is diag2) ELSEIF (ans4 is "N") OR (ans5 is "Y") THEN (diagnosis is diag3) ELSEIF (ans6 is "N") XOR (ans1 is "N") THEN (diagnosis is diag4) ENDIF The exact algorithm isn't important here. Let's say the user answers 3 questions, quits, then returns tomorrow to complete the remaining questions and get the answer. How would I code a DOS program to achieve that? I'm guessing I'll need to write the answers to a data file to be opened for update later. How would the program "know" where the user left off last time, so that it could continue from that point later on? Thank you Alex Caracatsanis