Pseudocode

To write a program as a pseudo-code do I just write down in a word document as Prompt and read?
Just got confused.
You can plan your programs with Pseudocode however you like, you could use a notepad or any other software, but usually it would be best if you write it down on a piece of paper.
I have to do that for my class...I already did a program with C++, and flow-chart but Just got a question. DO I solve the value for the program...For example if i wanted to compute age for a user in year, months, week and etc.
Should I write down the value as well or just write it down like follows:
Begin
Prompt for first name
read first name
prompt for last name
read last name
prompt for age
read age

Processing
FullName= First Name+Last Name
Age in Months=Age*MONTHS in YEAR
Age in Weeks=Age*WEEKS in YEAR
Age in Days=Age*DAYS in YEAR
Age in Hours=Age in Days*HOURS in DAY
Age in Minutes=Age in Hours*MINUTES in HOUR
...............

Prompt and output full name
prompt and output age
prompt and output age in months
prompt and output age in weeks
prompt and output age in days.
........................
...............
.........
.....
....
..
.
END


is that how we do it or should i write the values and names and everything?????
Thanks for help
No you don't normally write down the values, your pseudocode is looking good. But your programming plan might not be finished after only one draft. Often pseudocode needs multiple passes before it can be implemented in programming code, thought, your pseudocode looks ok but remember, pseudocode is a language that falls somewhere between English and a formal programming language, here's an example if i want to make a million dollars:

If you can think of a new and useful product
then that's your product
otherwise
repackage an existing product as your product
make an infomercial about your product
show the infomercial on TV
charge 100$ per unit of your product
sell 10,000 units of your product


point of a pseudocode is that everyone even non-programmers must at least understand it, the first 4 lines resemble an if and else clause, and that's intentional.
but like i said your programming plan might not be finished after only one draft, so i will use the 'stepwise refinement' technique to make it 'more detailed' such as:
take a step from my master plan to make a million dollars:

create an infomercial about your product

this might seem like too vague of a task. How do you create an infomercial? Using stepwise refiement, you can break down the single step into several others, so it becomes:

Write a script for an infomercial about your product
rent a TV studio for one day
Hire a production Crew
Hire an enthusiastic audience
Film the infomercial


there, now a part of the pseudocode has been thoroughly refined, looking at your pseudocode, it does look like it could use some refinement.



Last edited on
Thanks a lot Uk Marine.
Really appreciate your help.
To me, your "pseudocode" looks more like a use case, which is...
a list of steps, typically defining interactions between a role (known in UML as an "actor") and a system, to achieve a goal.

(from http://www.cplusplus.com/forum/beginner/111427/#msg608847a )

Pseudocode usually looks a bit more like a real programming language, but spelling thing out in normal language (see examples in Wikipedia entry.)

Andy

Pseudocode
http://en.wikipedia.org/wiki/Pseudocode

Use case
http://en.wikipedia.org/wiki/Use_case

Last edited on
Thanks all
Topic archived. No new replies allowed.