By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,171 Members | 1,037 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,171 IT Pros & Developers. It's quick & easy.

Multiple byte integers

P: n/a
I got a pointer problem, it finishes and takes the previous ma first
element dgt.

if(ma.numdgt > mb.numdgt)
{
a = int(pr1 -> dgt) + carry;
if(((pr1 -> dgt) + carry) > radix)
{
carry = a / radix;
a = a % radix;
}
else carry = 0;
m.append(a);
cout << a << ' ';
}

Jun 11 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Shuga schrieb:
I got a pointer problem, it finishes and takes the previous ma first
element dgt.

if(ma.numdgt > mb.numdgt)
{
a = int(pr1 -> dgt) + carry;
if(((pr1 -> dgt) + carry) > radix)
{
carry = a / radix;
a = a % radix;
}
else carry = 0;
m.append(a);
cout << a << ' ';
}


The problem is on line 42.

See here: http://www.parashift.com/c++-faq-lit...t.html#faq-5.8

--
Thomas
Jun 11 '06 #2

P: n/a
Shuga wrote:
I got a pointer problem, it finishes and takes the previous ma first
element dgt.

if(ma.numdgt > mb.numdgt)
{
a = int(pr1 -> dgt) + carry;
if(((pr1 -> dgt) + carry) > radix)
{
carry = a / radix;
a = a % radix;
}
else carry = 0;
m.append(a);
cout << a << ' ';
}


It would be a lot easier to help if we could see the definitions of ma,
mb, a, pr1, carry, radix, and m. Also perhaps an explanation of what
you expect the code to be doing.

--
Alan Johnson
Jun 11 '06 #3

P: n/a
Pls post the whole code!
Shuga 写道:
I got a pointer problem, it finishes and takes the previous ma first
element dgt.

if(ma.numdgt > mb.numdgt)
{
a = int(pr1 -> dgt) + carry;
if(((pr1 -> dgt) + carry) > radix)
{
carry = a / radix;
a = a % radix;
}
else carry = 0;
m.append(a);
cout << a << ' ';
}


Jun 12 '06 #4

P: n/a
Hi there,
Thanks for your concern. It's too long. I did try. If you like give
me your full email and I try to send it to you.

Jun 14 '06 #5

P: n/a

Hi Alan,
Thank for your concern.
ma, mb and m are classes. I trying to add ma + mb into m.
Carry is int stored into a byte. Radix is an integer base 256.
The code is too long to be posted. If you're interested give me your
full email and I will try to send you

Shuga

Jun 14 '06 #6

P: n/a

Hi Alan,
Thank for your concern.
ma, mb and m are classes. I trying to add ma + mb into m.
Carry is int stored into a byte. Radix is an integer base 256.
The code is too long to be posted. If you're interested give me your
full email and I will try to send you

Shuga

Jun 14 '06 #7

P: n/a
I have a multiple byte integers working with pointers. When I add two
of these integers I get the last digit added to the old first digit. It
working on an if statement. The msg. I get is Thread stopped at(file
name + path) Access violation at 0x401ff4 read of address 0x0.

Shuga

Jun 22 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.