November 22nd, 2012, 11:41 AM
How would I do pseudocode for this?
I've been told to write pseudocode that will...
-prompt the user for a first name and assign it to variable FName.
-prompt the user for a last name and assign it variable LName.
-prompt the user for a number and assign it to variable PrintTimes.
-use a looping structure for validation to check that the PrintTimes number is from 0-5.
Use a looping structure that will print "Hello FirstName LastName" according to the number of times entered by the user (PrintTimes).
And apparently in all this there is a "for loop" that plays a part by being where the decision will be at the top of the loop.
Could someone please give me a boost and tell me if I’m on the right track or not? .
//Declare and initialize variables
//Get “firstname” input
//Assign to variable FName
//Get “lastname” input
//Assign to variable LName
//Prompt for number input
//Assign to PrintTimes
//Validate with loop that the input is betwenn 0-5
//Format output for printing
//Display "Hello FirstName LastName"
November 23rd, 2012, 08:17 AM
See especially the part: syntax.
It's basically code where you have the variables and so on, you just don't go into details on how certain things like printing are implemented , you can just say print "foo".
You don't need a loop for the validation - you need it to print it x times.
The rest I leave up to you, because this smells like a school assignment
for i:= 1 to printTimes
print "Hello" firstName lastName