Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to add additional character in multiple places of an array string

How to add additional character in multiple places of an array string

Scheduled Pinned Locked Moved C / C++ / MFC
c++data-structurestutorialquestionlearning
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Parag Bhuyan
    wrote on last edited by
    #1

    Hii I am a beginner of C++ programming environment. My question: Suppose there is a array..and the contents of the array="ironman" Now, i need to insert some additional character to this string like "i*r%o#n@m^a!n" Also i need to reversely generate the original contents. That means from "i*r%o#n@m^a!n" to "ironman".. Also i have one constraint, i cannot use much of library function..i can use loop only. Thanks in Advance !!

    J L CPalliniC 3 Replies Last reply
    0
    • P Parag Bhuyan

      Hii I am a beginner of C++ programming environment. My question: Suppose there is a array..and the contents of the array="ironman" Now, i need to insert some additional character to this string like "i*r%o#n@m^a!n" Also i need to reversely generate the original contents. That means from "i*r%o#n@m^a!n" to "ironman".. Also i have one constraint, i cannot use much of library function..i can use loop only. Thanks in Advance !!

      J Offline
      J Offline
      jeron1
      wrote on last edited by
      #2

      What have you tried?

      "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

      1 Reply Last reply
      0
      • P Parag Bhuyan

        Hii I am a beginner of C++ programming environment. My question: Suppose there is a array..and the contents of the array="ironman" Now, i need to insert some additional character to this string like "i*r%o#n@m^a!n" Also i need to reversely generate the original contents. That means from "i*r%o#n@m^a!n" to "ironman".. Also i have one constraint, i cannot use much of library function..i can use loop only. Thanks in Advance !!

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Think about how you address elements of the array; that will help you to change particular letters. Similarly that will give you a clue how to reverse it.

        1 Reply Last reply
        0
        • P Parag Bhuyan

          Hii I am a beginner of C++ programming environment. My question: Suppose there is a array..and the contents of the array="ironman" Now, i need to insert some additional character to this string like "i*r%o#n@m^a!n" Also i need to reversely generate the original contents. That means from "i*r%o#n@m^a!n" to "ironman".. Also i have one constraint, i cannot use much of library function..i can use loop only. Thanks in Advance !!

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          Well, it doesn't look a daunting task, however you have to allocate a new array having the double size of the original one. Then you could copy the original items o[i] into new ones n[2*i], finally add the 'additional characters at odd indices. The inverse operation, is, well, inverse, namely n[2*i] -> o[i].

          In testa che avete, signor di Ceprano?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups