Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Pseudocode help please

We are currently beginning array's

Question:

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
[code]
Get.Those.Names


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

Comments

  • Malcolm_McLeanMalcolm_McLean Posts: 248Member ✭✭
    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=http://www.lulu.com/bgy1mm] MiniBasic how to write a script interpreter [/link]
    [link=http://www.lulu.com/bgy1mm] Basic Algorithms (in C) [/link]
Sign In or Register to comment.