hi friends em new here my first day first post

friends any one of you plz tell me long hand int calculations project its urgent coz i have to present it 26th of this month.:confused:

Printable View

- 01-13-2007neha007any one plz help me
hi friends em new here my first day first post

friends any one of you plz tell me long hand int calculations project its urgent coz i have to present it 26th of this month.:confused: - 01-13-2007The Brain
wtf..>?!?!

- 01-13-2007twomers
Please be more specific!

- 01-13-2007Salem
So what were you planning to do for the next two weeks?

I suppose we should be thankful, some people show up here with 13 hours to go to the deadline (and they haven't started yet).

You've got plenty of time, make an attempt for the next day or two then post something. - 01-14-2007neha007
uuuuuuuuuuuuufffffffffff plz any one of u help me i have30 assignments of c as well n a project of communication skills and a n assigment of globalization and and and.......... and examz starts from 26th of this month i m too much bz but it doesnot matter how much i bz actually i dont how to solve it

- 01-14-2007stinkipete
So what's the problem? Specifically . . . ?

- 01-14-2007twomers
Show us some code and we'll help you solve the problems. Just paste them within [code][/code] tags

- 01-14-2007neha007Code:
`#define MAXDIGITS 100;`

main()

type struct{

char digit[MAXDIGITS]

int signbit,

int last digit,

}big num;

digit m1,m2,m3;

***************************************

ch_to_bignum(char*s,bignum*n)

{

int i;

if(s[0]!='-')

{

n->signbit='PLUS'

i=0;}

else

{i=1;

n->signbit='MINUS'

}

strcpy(n->digits,&s[i])

n->lastdigit=strlen(n->digits)

}

there are too much errors in this code actually this was given by my teacher and i copy it from white board - 01-14-2007Salem
> #define MAXDIGITS 100;

Drop the ; at the end of this line

> main()

You should be specific about what the function returns.

main for instance always returns int. Your other function should probably return void

> char digit[MAXDIGITS]

Each member of your struct should finish with a ;

Like

char digit[MAXDIGITS];

> int last digit,

C doesn't allow spaces in variable names. So

int lastdigit;

int lastDigit;

int last_digit;

pick a style you like.

> n->signbit='PLUS'

Maybe just

n->signbit='+';

Again, don't forget those ; - 01-14-2007twomers
You sure your teacher wrote that code?

Here's the function fixed:

Code:`typedef struct`

{

char digit[100];

int signbit;

int last_digit;

} big_num;

void ch_to_bignum( char*s,big_num*n )

{

int i;

if(s[0]!='-')

{

n->signbit='+';

i=0;

}

else

{

i=1;

n->signbit='-';

}

strcpy(n->digit,&s[i]);

n->last_digit=strlen(n->digit);

}

Use it like this:

Code:`int main( void )`

{

big_num m1;

char *test_ch = "242";

ch_to_bignum( test_ch, &m1 );

cout<< m1.digit << '\n'

<< m1.last_digit << '\n'

<< m1.signbit << '\n';

return 0;

}

- 01-14-2007neha007
hey this is not the actuall code my sir gives my this i have to solve long long integres calculation e.d 10000000000000000000000000000000000000000000000000 000000000000000+1000000000000000000000000000000000 000000000000000000000000000000000000000000000 like this and subtraction and division as well

- 01-14-2007neha007Quote:

Originally Posted by**Salem**

- 01-14-2007neha007Quote:

Originally Posted by**twomers**

- 01-14-2007laserlightQuote:

thx buddy but this will not only solve my prob me have to solve long long int calculations

- 01-14-2007neha007
ya my teacher wrote that code but he was just giving us hints