Thread: string manipulation

  1. #1
    Registered User
    Join Date
    Jul 2002

    Cool string manipulation

    Hi experts,

    I am fairly new to C++ but what I am trying to do is read the text one character at a time (told not to use arrays yet) then if the user enters a word where a character occurs twice in a row then I am suppose to upper case the first occurrence and remove the second. example user enters "oops" output would be "Ops."
    Any help on this subject or just string manipulation itself would be a great help. thank-you

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    you could cheat (or at least do something your instructor probably hasn't told you yet).

    get a character
    if that character has been printed before (use a temporary varable to tell), then write a backspace character (number 8 in the ascii system) and print the uppercase of your character
    else print just print the character
    store the character in a temporary variable for future reference.
    repeat for every character

    now put this into C code. it's not hard.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  2. Compile Error that i dont understand
    By bobthebullet990 in forum C++ Programming
    Replies: 5
    Last Post: 05-05-2006, 09:19 AM
  3. Replies: 4
    Last Post: 03-03-2006, 02:11 AM
  4. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 PM
  5. string manipulation
    By SPEKTRUM in forum Linux Programming
    Replies: 3
    Last Post: 01-26-2002, 11:41 AM