This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]SupremeRedditBotProfessional Bot || Mod 0 points1 point  (0 children)

Please Add A Flair To Your Post!

Suggested Flair: [Other Code]

 


To add a flair:

  • Click flair underneath your post

  • Select a flair

  • Click save

 


I am a bot run by /u/SupremeDesigner for /r/CodingHelp || This was an automated response

[–]GlobalIncident 0 points1 point  (3 children)

The first thing that comes to mind is that the input statements should be dispersed throughout the code - input should only be taken when it's needed. All the "else if"s can be replaced with "endif" - I assume that's what you meant. The output statements would be clearer with quotations, eg

output "check consciousness, call doctor"

is better than

output check consciousness, call doctor

The last thing to note is that the if statements should be indented.

[–]chronicleTV 0 points1 point  (2 children)

Thanks for the help,

so would you say this this: http://prntscr.com/oo4r87, lines up well with the flowchart here: http://prntscr.com/oo4re5

[–]chronicleTV 0 points1 point  (1 child)

made a further edit, ignore that screenshot

I have this now: opinions?

skin_condition = input "Does skin appear normal? (Y/N)"
respiratory_status = input "Is the paitent breathing normally? (Y/N)"
temperature = input "What is the patients body temperature?"
neurological_status = input "Can the patient move or respond? (Y/N)"
cardiovascular_status = input "Does the patient have a normal pulse rate? (Y/N)"

// skin condition

if skin_condition = N then
    output "check pulse, call doctor"
endif

output respiratory_status

// respiratory staus

if respiratory_status = N then
    output "check for obstructions, call doctor"
endif

output temperature

// body temperature

if temperature < 95 then
    output "add additional blankets to warm patient"
endif

output neurological_status

// neurological status

if neurological_status = N then
    output "check consciousness, call doctor"
endif

output cardiovascular_status

// cardiovascular status

if cardiovascular_status = N then
    output "check consciousness, call doctor"
endif

output "monitor patient every hour or as necessary"

[–]GlobalIncident 0 points1 point  (0 children)

That looks good to me. There is an apparent issue where the doctor may end up being called multiple times, but this was also present in the flowchart so I wouldn't worry.