`256`

different (ordered) symbols.12,892,469 members (45,925 online)

Email

Password

Sign in with

Hello.

How we can define a new basis types?

We know hexadecimal or decimal base and conversions between these types, now how is possible to define a 256 basis type of data?

(e.g. A type for keep the ASCII values)

Thanks.

How we can define a new basis types?

We know hexadecimal or decimal base and conversions between these types, now how is possible to define a 256 basis type of data?

(e.g. A type for keep the ASCII values)

Thanks.

smss IR407

Comments

The 'usual way': define

`256`

different (ordered) symbols.Comments

I want to do it without defining the symbols, through having the certain value.

You cannot have a base without thew symbols, for instance, base two has the symbols

If you want__instead__ have a variable type that can hold

`{'0', '1'}`

while base hex has `{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}`

.If you want

`256`

different values, then, you already have it, it is the `char`

(or the `unsigned char`

).Can I assuming an array for that symbols? (int array[256];//and in it save the numbers)

Doesn't have anyone an idea??

Of course you can.

In C++ there are no separate types for storing hexadecimal or decimal value. Such integral values are all stored in binary types like

There is already a basic type in C++ to store ASCII characters:

Perhaps I didn't understand your question. Please try to rephrase it.

`int`

or `unsigned int`

, and to show them to the outside world you can convert them into any arbitrary number base by library functions like printf or ltoa.There is already a basic type in C++ to store ASCII characters:

`char`

.Perhaps I didn't understand your question. Please try to rephrase it.

Comments

Yes, I know these.

I trying to define 256 Basic for a software.

Consider on this e.g:

A_245 = 255

A_245 + 1 = ??

In char types, we have only an one character for holding value and if that number is larger, char type can't keep that, I need a 256 Basic System for counting 256 Basic Numbers from zero to Extreme. Is my expression illustrative?

I trying to define 256 Basic for a software.

Consider on this e.g:

A_245 = 255

A_245 + 1 = ??

In char types, we have only an one character for holding value and if that number is larger, char type can't keep that, I need a 256 Basic System for counting 256 Basic Numbers from zero to Extreme. Is my expression illustrative?

An unsigned char can hold values from 0 ... 255. Are you trying to construct a data type that holds 0 ... 256? Is that what you mean?

To describe what I mean, let's assume that an unsigned character have the 255 value, I want to add digit "1" and create two digits, For example in decimal basic: 9+1=10 (a digit+ a digit= two digits).

Example: in 256 basic A245 + 1 = A1_1, that A245 is a digit(255 in decimal 1,2,3,...,10,A2,A3,...,A245) and A1_1 is two digits in 256 basic = 1*255^1+1 in decimal.

I want to create a class or a structure or, anything so i can calculating the digits in 256 basic.

Example: in 256 basic A245 + 1 = A1_1, that A245 is a digit(255 in decimal 1,2,3,...,10,A2,A3,...,A245) and A1_1 is two digits in 256 basic = 1*255^1+1 in decimal.

I want to create a class or a structure or, anything so i can calculating the digits in 256 basic.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject,
503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada
+1 416-849-8900 x 100

`char`

.