How to present Users Option in Algorithm or Pseudo Code

I have a software that asks user to choose different options from 3 sets of parameters before running the program with those inputs. However, I don't know how to show that in an algorithm or a Pseudo code in a correct way. Example

step 1: for X, choose from 5-10-15-20 
step 2: for Y, choose between a,b,c,d
step 3: for Z, choose from 10 to 20
step 4: calculate M=X+2Z
step 5: print row M of Y

Thanx for the help in advance

Answers


There are no 'correct' ways in pseudo-code. You can really just do whatever you want, the only preference is that all terms and syntax used should be clearly understandable, thus, for syntax, it should be commonly used elsewhere to indicate the desired operation.

One option comes to mind: "Let X = a user-picked value from one of these: 5, 10, 15"

More brief: "Let the user pick X ∈ {5, 10, 15}"

Obviously if your algorithm fundamentally includes getting input from the user, this is not possible, but if the user input can be separated from your algorithm without changing anything, I would think a better way would be to say the value is given:

"Given X ∈ {5, 10, 15}"

It would make sense to me that all "Given"'s should be at the start of the algorithm. If you want to get something from the user in the middle of an algorithm, saying "Let the user pick..." as above would make more sense.

"In algorithms" doesn't really make sense. One can describe an algorithm in natural language (words / sentences / paragraphs), pseudo-code or in code in a specific language. And usually the user input is outside of the algorithm. For example, one would not say to get a list of values from the user for a sorting algorithm, one would start with "Given a list of values".


Need Your Help

Is there a matplotlib counterpart of Matlab “stem3”?

python matlab matplotlib

It is quite easy to make a 3d stem plot with stem3 command as documented in http://www.mathworks.com/help/techdoc/ref/stem3.html

When do you dispose GDI+ resources?

.net gdi+

Many GDI+ classes implement IDisposable, but I'm not sure when I should call Dispose. It's clear for instances I create with new or static methods like Graphics.CreateGraphics. But what about objects

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.