any one plz help me

This is a discussion on any one plz help me within the C++ Programming forums, part of the General Programming Boards category; hi friends em new here my first day first post friends any one of you plz tell me long hand ...

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    35

    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. #2
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    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

  3. #3
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    Please be more specific!

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,437
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    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. #6
    Registered User
    Join Date
    Jan 2007
    Posts
    8
    So what's the problem? Specifically . . . ?

  7. #7
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    Show us some code and we'll help you solve the problems. Just paste them within [code][/code] tags

  8. #8
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    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. #9
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,437
    > #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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  10. #10
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    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;
    }
    Last edited by twomers; 01-14-2007 at 07:55 AM.

  11. #11
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    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. #12
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    Quote 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. #13
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    Quote 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. #14
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,409
    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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  15. #15
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    ya my teacher wrote that code but he was just giving us hints

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can any1 plz make this assignment
    By jean in forum C Programming
    Replies: 17
    Last Post: 05-13-2009, 09:19 PM
  2. [Request] Need Help Plz
    By TylerD in forum Tech Board
    Replies: 4
    Last Post: 01-03-2009, 08:54 AM
  3. plz help me with simple string comparison.
    By MegaManZZ in forum C++ Programming
    Replies: 11
    Last Post: 02-18-2008, 12:11 PM
  4. Anyone plz help me
    By Rose_Flowers in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 09-17-2003, 12:01 PM
  5. help plz plz
    By nsssn73 in forum C++ Programming
    Replies: 2
    Last Post: 06-03-2002, 08:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21