Printing my initials and surname

This is a discussion on Printing my initials and surname within the C++ Programming forums, part of the General Programming Boards category; Hi, I am supposed to create a little program that reads my full name and prints 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,831
    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,662
    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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21