Create New Data Type

i need to create a new integer data type called BigInt to store a big big integer, which includes Dint(8 bytes) and Qint(16 bytes)

here is the hint/
1
2
3
4
typedef struct BigInt
{
Int data[2]; 
}


How can i "scanf" and "printf" them????
1
2
void ScanBigInt(const char *format, BigInt &x)
if format is “%dd” -> input Dint, if format is “%qd”--> input Qint


void PrintBigInt(const char *format, BigInt x)

Until now
i dont have any ideas!!!
Thanks in advance!!
No one s faced this problem?
What will you put in data? Is data[0] the Least significant figure or the most significant figure? Are numbers stored in binary form or decimal? Put another way, does data[0] contain 32 bits? Or 9 digits? Or is it BCD and it contains 8 digits? How will you handle negative numbers?

In other words, you need to define exactly what you want in these fields before you can figure out how to put it there.
I really don't understand your problem. What is wrong with using scanf() and printf() to print the member variable?
1
2
3
4
5
6
7
...
   BigInt bigInt;
   bigInt.data[0] =200;
   bigInt.data[1] = 3000;
...
   printf("%d%d, bigInt.data[0], bigInt.data[1]);
... 


Topic archived. No new replies allowed.