Do they mean the Hex number for the ASCII character 0-9?

  • Thread starter vladittude0583
  • Start date
  • Tags
    Mean
In summary, the conversation is about writing code to count the number of decimal digits (0-9) input from the keyboard until the user presses '\n' and then displaying this count on the monitor. There is a question about whether the decimal digits refer to the Hex number for the ASCII character 0-9, and it is clarified that they do. It is also mentioned that the ASCII characters for 0-9 are non-printing and cannot be entered directly from the keyboard. The solution involves taking in the input as a string, examining each character individually, and writing a function to determine if the character is a decimal digit.
  • #1
vladittude0583
40
0
Hey guys, I need a little bit of help understanding this question and writing the code for it:

Write the code to count the number of decimal digits (0-9) input from the keyboard until the user presses '\n' and then display this count on the monitor (Declare necessary variables)

Regarding the decimal digits, do they mean the Hex number for the ASCII character 0-9? Could you please clarify this for me? Thanks.
 
Physics news on Phys.org
  • #2
i'm pretty sure they mean the ascii code for characters 0-9. (without looking)i believe all the ascii characters with values 0 through 9 are non-printing and can't be entered from the keyboard without a combination of keypresses (alt codes). whether you look at them as hex is up to you.
 
  • #3
You need to take in the input as a string, examine each string character individually and write a function to determine if the character examined is 0-9. You know what to do from here, right?
 

Related to Do they mean the Hex number for the ASCII character 0-9?

H2Question 1: What is a Hex number?

A Hex number, short for hexadecimal, is a numbering system that uses 16 symbols to represent numbers. It includes the digits 0-9 and the letters A-F.

H2Question 2: How is a Hex number related to ASCII characters?

ASCII (American Standard Code for Information Interchange) is a character encoding standard that assigns a unique number to each character. The Hex numbers 0-9 are used to represent the numbers 0-9 in ASCII.

H2Question 3: Why is the Hex number for ASCII characters important?

The Hex number for ASCII characters is important because it allows computers to store and process text and other data. It also allows for compatibility between different computer systems.

H2Question 4: How do you convert a Hex number to an ASCII character?

To convert a Hex number to an ASCII character, you need to know the corresponding decimal value for the Hex number and then use an ASCII table to find the corresponding character.

H2Question 5: Is there a limit to the number of ASCII characters that can be represented by a Hex number?

Yes, there is a limit. The Hex numbers 0-9 can only represent the first 10 ASCII characters (0-9), while the letters A-F can represent the remaining 6 ASCII characters (10-15). Therefore, a Hex number can only represent a maximum of 16 ASCII characters.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
11
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
15
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
6K
Back
Top