# Thread: any one plz help me

1. ## any 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.

2. wtf..>?!?!

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

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

6. So what's the problem? Specifically . . . ?

7. Show us some code and we'll help you solve the problems. Just paste them within [code][/code] tags

8. Code:
```#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

9. > #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 ;

10. 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);
}```
There were tones of mistakes! From misnaming variables, missing ;'s, spaces in variables not to mention the indenting!

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;
}```

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

12. Originally Posted by Salem
> #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 ;
thx but in last line i have to print PLUS not +

13. Originally Posted by twomers
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);
}```
There were tones of mistakes! From misnaming variables, missing ;'s, spaces in variables not to mention the indenting!

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;
}```
thx buddy but this will not only solve my prob me have to solve long long int calculations

14. thx buddy but this will not only solve my prob me have to solve long long int calculations
Yes, you are well on your way to solving that. You cannot expect generous handouts without doing your part. If you do not do your part, you can expect handouts that generously fail you in subtle ways devised by us.

15. ya my teacher wrote that code but he was just giving us hints