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. 3 Integer store with Bit Storage

3 Integer store with Bit Storage

Scheduled Pinned Locked Moved C / C++ / MFC
comhostingcloudsecuritybusiness
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.
  • S Offline
    S Offline
    sheronici
    wrote on last edited by
    #1

    Consider an 8-bit compiler say Turbo C, in which we have an integer of size, say 2-words i.e. 16-bits or 2 bytes. You need to store three integer values which are supposed to be as:

    Name | Range | Size Required

    =====================================

    Integer 1 | 0-3 | 2bits (00-11 in binary)

    Integer 2 | 0-5 | 3bits (000-101 in binary)

    Integer 3 | 0-7 | 3bits (000-111 in binary)

    In total, we need only 8bits to store all of these three values. Which means that a single variable of integer data type has enough memory to accommodate these values.

    The challenge is to store all of these three variables into a single instance of integer data type and retrieve it whenever required.

    In other words, you need to develop a program which can - at the maximum - use only two instances of integer data type, first one for the purpose of scanning values from the standard input device say keyboard and the second one to store the data entered by user in the form of three integer variables as discussed above and print them by retrieving it from the second instance in which the data was stored.
    Company Description Secpanel is a DIY security tool for cloud servers.
    Please see www.secpanel.com Requirements We are trying to solve the security problem for millions of servers on the internet. We are looking for people who are crazy enough to think they can solve the toughest of problems. And do. If you love to code and are sick of the protocol/HR/politics of big organizations, you should talk to us.

    Instead of a resume, please write a small piece of code for the following scenario:

    Consider an 8-bit compiler say Turbo C, in which we have an integer of size, say 2-words i.e. 16-bits or 2 bytes. You need to store three integer values which are supposed to be as:

    Name | Range | Size Required

    =====================================

    Integer 1 | 0-3 | 2bits (00-11 in binary)

    Integer 2 | 0-5 | 3bits (000-101 in binary)

    Integer 3 | 0-7 | 3bits (000-111 in binary)

    In total, we need only 8bits to store all of these three values. Which means that a single variable of integer data type has enough memory to accommodate these values.

    The challenge is to store all of these three variables into a single instance of integer data type and retrieve it whenever required.

    In other words, you need to develop a program which can - at the maximum - use only two instances of integer data type, first one for the purpose of scanning values from the standard input device say keyboard and t

    C 1 Reply Last reply
    0
    • S sheronici

      Consider an 8-bit compiler say Turbo C, in which we have an integer of size, say 2-words i.e. 16-bits or 2 bytes. You need to store three integer values which are supposed to be as:

      Name | Range | Size Required

      =====================================

      Integer 1 | 0-3 | 2bits (00-11 in binary)

      Integer 2 | 0-5 | 3bits (000-101 in binary)

      Integer 3 | 0-7 | 3bits (000-111 in binary)

      In total, we need only 8bits to store all of these three values. Which means that a single variable of integer data type has enough memory to accommodate these values.

      The challenge is to store all of these three variables into a single instance of integer data type and retrieve it whenever required.

      In other words, you need to develop a program which can - at the maximum - use only two instances of integer data type, first one for the purpose of scanning values from the standard input device say keyboard and the second one to store the data entered by user in the form of three integer variables as discussed above and print them by retrieving it from the second instance in which the data was stored.
      Company Description Secpanel is a DIY security tool for cloud servers.
      Please see www.secpanel.com Requirements We are trying to solve the security problem for millions of servers on the internet. We are looking for people who are crazy enough to think they can solve the toughest of problems. And do. If you love to code and are sick of the protocol/HR/politics of big organizations, you should talk to us.

      Instead of a resume, please write a small piece of code for the following scenario:

      Consider an 8-bit compiler say Turbo C, in which we have an integer of size, say 2-words i.e. 16-bits or 2 bytes. You need to store three integer values which are supposed to be as:

      Name | Range | Size Required

      =====================================

      Integer 1 | 0-3 | 2bits (00-11 in binary)

      Integer 2 | 0-5 | 3bits (000-101 in binary)

      Integer 3 | 0-7 | 3bits (000-111 in binary)

      In total, we need only 8bits to store all of these three values. Which means that a single variable of integer data type has enough memory to accommodate these values.

      The challenge is to store all of these three variables into a single instance of integer data type and retrieve it whenever required.

      In other words, you need to develop a program which can - at the maximum - use only two instances of integer data type, first one for the purpose of scanning values from the standard input device say keyboard and t

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      nobody here is going to do your work for you. and if you can't do the work, you shouldn't get the job[^]

      image processing toolkits | batch image processing

      M R 2 Replies Last reply
      0
      • C Chris Losinger

        nobody here is going to do your work for you. and if you can't do the work, you shouldn't get the job[^]

        image processing toolkits | batch image processing

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

        :laugh: priceless!!

        Watched code never compiles.

        1 Reply Last reply
        0
        • C Chris Losinger

          nobody here is going to do your work for you. and if you can't do the work, you shouldn't get the job[^]

          image processing toolkits | batch image processing

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #4

          :laugh:

          "Real men drive manual transmission" - Rajesh.

          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