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.
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.
wtf..>?!?!
- "Problem Solving C++, The Object of Programming" -Walter Savitch
- "Data Structures and Other Objects using C++" -Walter Savitch
- "Assembly Language for Intel-Based Computers" -Kip Irvine
- "Programming Windows, 5th edition" -Charles Petzold
- "Visual C++ MFC Programming by Example" -John E. Swanke
- "Network Programming Windows" -Jones/Ohlund
- "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
- "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel
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.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
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
So what's the problem? Specifically . . . ?
Show us some code and we'll help you solve the problems. Just paste them within [code][/code] tags
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
> #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 ;
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
You sure your teacher wrote that code?
Here's the function fixed:
There were tones of mistakes! From misnaming variables, missing ;'s, spaces in variables not to mention the indenting!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; }
Last edited by twomers; 01-14-2007 at 08:55 AM.
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
thx but in last line i have to print PLUS not +Originally Posted by Salem
thx buddy but this will not only solve my prob me have to solve long long int calculationsOriginally Posted by twomers
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.thx buddy but this will not only solve my prob me have to solve long long int calculations
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
ya my teacher wrote that code but he was just giving us hints