470,849 Members | 683 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

Multiple byte integers

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
7 2075
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
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
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
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

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

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
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.

Similar topics

9 posts views Thread by w3r3w0lf | last post: by
235 posts views Thread by napi | last post: by
20 posts views Thread by adityavasishth | last post: by
4 posts views Thread by Dennis Myrn | last post: by
16 posts views Thread by dylanthomasfan | last post: by
45 posts views Thread by Ajay | last post: by
18 posts views Thread by p.lavarre | last post: by
11 posts views Thread by K Viltersten | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.