Pseudocode help please

We are currently beginning array's


Design an algorithm in pseudocode that will accept a person's name from the screen entered as surname, first name, seperated by a comma. Your program is to display the name as first name, followed by three blanks, followed by the surname.


I know it's kind of lame of me to ask for pseudocode help, but i just need peoples opinions about how they would code this. It's not a test or lab or anything like that, it's actually just a problem i've chosen out of my book so i can practice more. thanks for looking

My try, please give me opinions

Set NameCheck = True
Set LastName(Index) = 0
Set FirstName(Index2) = 0
DoUntil NameCheck = False
Prompt =


  • The assignment isn't very well formed.

    Clearly you need to prompt for input, input the surname and the name, check it, assign one string to name and one to surname, and output the result in the opposite order.

    The snag is that input is done differently in different languages. Perl has regular expressions built in, so you would naturally construct a regular expression for the name to check it. In C, you can't even read in an abritrary-length line without substantial processing. It's easy to write a C program that won't break for sane names of less than, say, 256 characters, however. (Should you accept any sequence of characters containing a comma, only the basic Latin letters, should you insist on upper case for the initial letter, should whitespace within the name be restricted to single space characters, what happens if the input contains two commas? These are questions that can't really answer from the specification).
    Then output is done differently in different languages. Most languages allow some from of the printf() statement, which makes it easy.
    Read my books
    [link=] MiniBasic how to write a script interpreter [/link]
    [link=] Basic Algorithms (in C) [/link]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion