How to present Users Option in Algorithm or Pseudo Code -
i have software asks user choose different options 3 sets of parameters before running program inputs. however, don't know how show in algorithm or pseudo code in correct way. example
step 1: x, choose 5-10-15-20 step 2: y, choose between a,b,c,d step 3: z, choose 10 20 step 4: calculate m=x+2z step 5: print row m of y
thanx in advance
there no 'correct' ways in pseudo-code. can whatever want, preference terms , syntax used should understandable, thus, syntax, should commonly used elsewhere indicate desired operation.
one option comes mind: "let x = user-picked value 1 of these: 5, 10, 15"
more brief: "let user pick x ∈ {5, 10, 15}"
obviously if algorithm fundamentally includes getting input user, not possible, if user input can separated algorithm without changing anything, think better way value given:
"given x ∈ {5, 10, 15}"
it make sense me "given"
's should @ start of algorithm. if want user in middle of algorithm, saying "let user pick..."
above make more sense.
"in algorithms" doesn't make sense. 1 can describe algorithm in natural language (words / sentences / paragraphs), pseudo-code or in code in specific language. , user input outside of algorithm. example, 1 not list of values user sorting algorithm, 1 start "given list of values".
Comments
Post a Comment