Thread: Printing my initials and surname

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    71

    Printing my initials and surname

    Hi, I am supposed to create a little program that reads my full name and prints my initials and surname
    eg Joe Fred Bloggs outputs J. F. Bloggs

    It doesn't mention which function I should use, and without a little hint of a function or type of loop than I really don't know where to start.

    Could anyone give me some advice please?

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    That won't work as it stands of course! But it gives you a start.

    What you'll need to do is read in the string as a whole. Output the first character, then ignore all characters until you reach a space when you ouput a dot and a space, then output the next character, and repeat the procedure for the second name, after that copy the rest of the characters.

    Try it then post your code if you have trouble.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    It doesn't mention which function I should use

    The whole point is for you to write the function. If you could just call a function for every task, there wouldn't be much to learning programming.

Popular pages Recent additions subscribe to a feed