Trying to complete a program I've found. I'm fairly new at this, I'm really only looking for leads; not to have someone write it for me. Maybe an example or two of code to present options for me.
I will attempt to make a number of smaller programs in order to make sure I understand what is going on here.....mod check, switch statement, etc.
This is what I have:
Write an interactive program which makes a preliminary diagnosis of influenza, cold, allergy or unknown. The possible symptoms are: (1) fever, (2) head-ache, (3) sore throat,
(4) cough, (5) runny nose and (6) sneezing.
The diagnosis is determined under the following conditions:
(1) Influenza - A fever and two or more additional symptoms.
(2) Cold ------ At least three symptoms without a fever.
(3) Allergy --- At least one symptom without a fever.
(4) Unknown --- Fever with no other symptoms or any other condition not covered above.
Input Data: Use the following to test your program.
A 'y' or 'Y' means yes the patient has the symptom, 'n' or 'N' means no the patient doesn't have the symptom.
When testing, use exactly the values given including case and in the stated order! The notation something(something) means try(retry) e.g. when prompted for the symptom "sore throat" for the first patient, you should first try u then y.
# Fever Headache Sore Throat Cough Runny Nose Sneezing
835174 Y N u(y) U(y) m(n) M(y)
841057 y y y n y y
640524 n n n y y y
375817 n y y y n n
639781 y n n n n y
145830 n n n n y y
514381 y n n n y n
904516 n n n n n y
784215 y y n n y n
834127 n y n y n y
452382 (Note: The transposition will cause check digit failure.)
453282 n n y y y n
Output Result: The following is an example of what the output should look like:
Hospital Diagnostic Center
Enter the patient number (0 to exit): 123456
Which of the following symptoms does the patient have (Y for yes, N for no);
Fever -------- y
Headache ----- n
Sore Throat -- y
Cough -------- y
Sniffles ----- n
Sneezes ------ n
The preliminary diagnosis is: Influenza
Enter the patient number (0 to exit): 0
Diagnostic Program Terminated
(1) Display this heading line only once i.e. when the program is first started up.
(2) If the patient number fails to pass the "mod 10 check digit"
technique, display "Invalid patient number." and prompt the
user to enter a correct number.
(3) Allow for either an upper or lower case response. If the response is neither Y, y, N nor n, display "Invalid entry." and reprompt the user.
Use either getc(stdin) or its variant getchar(c) for reading the user response. Finally, your program should have no difficulty dealing with responses such as Yes, NO, YUP, NOPE etc. as-long-as the first character can be construed as a yes or no response.
(4) Use the switch statement to implement the display of the preliminary diagnosis.
It is entirely possible the patient might have more the one diagnosis. Be sure to display all possibilities.
(5) If a patient number of 0 (zero) is entered, terminate the program else continue to prompt for symptoms.
Thanks once again....you guys helped me last weekend on something I was stuck on. I appreciate all the pointers.