1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Rep Power

    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.

    //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"
    Could someone please give me a boost and tell me if I’m on the right track or not? .
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Rep Power

    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.

    for i:= 1 to printTimes 
        print "Hello" firstName lastName
    end for
    The rest I leave up to you, because this smells like a school assignment

IMN logo majestic logo threadwatch logo seochat tools logo