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. Managed C++/CLI
  4. Didn't Understand to logic of calculation of this program.?

Didn't Understand to logic of calculation of this program.?

Scheduled Pinned Locked Moved Managed C++/CLI
question
3 Posts 3 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.
  • T Offline
    T Offline
    Taqi_Shah
    wrote on last edited by
    #1

    when 1 is given as input following program shows b as output why is that so I know that 1 given to char is manipulated differently but how it's being manipulated please explain. #include #include using namespace std; int main() { char ch; cout<<"enter ch "; cin>>ch; ch=ch*2; cout<

    L M 2 Replies Last reply
    0
    • T Taqi_Shah

      when 1 is given as input following program shows b as output why is that so I know that 1 given to char is manipulated differently but how it's being manipulated please explain. #include #include using namespace std; int main() { char ch; cout<<"enter ch "; cin>>ch; ch=ch*2; cout<

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

      Taqi_Shah wrote:

      1

      Taqi_Shah wrote:

      ch=ch*2;

      1 on the ASCII chart is 49 49 * 2 = 98 98 on the ASCII chart is b

      1 Reply Last reply
      0
      • T Taqi_Shah

        when 1 is given as input following program shows b as output why is that so I know that 1 given to char is manipulated differently but how it's being manipulated please explain. #include #include using namespace std; int main() { char ch; cout<<"enter ch "; cin>>ch; ch=ch*2; cout<

        M Offline
        M Offline
        MicroVirus
        wrote on last edited by
        #3

        Actually, the printed value depends on how the character values (value of ch) is interpreted as a character. For instance, when using Windows console the following mapping (typically) is used: http://en.wikipedia.org/wiki/Code_page_850[^] EDIT: That table only contains the top half (symbol half) of the story. For the lower part, refer to any ASCII documentation, for instance: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters[^]

        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