Thread: any one plz help me

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Here's another hint: think of how you do addition by hand. You would add one column of digits, carrying over if needed.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #17
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    ya i know i have to solve it like that but i cant understand how to right that code

  3. #18
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Try. Fail. Post code. We might fix it for you or tell you how to.

  4. #19
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    b quick buddies and i have one two more probs with my assignment acctually i have to calculate zakat of 500.98gram gold(24 carat)
    and 2) how can i assign an array to another

  5. #20
    Registered User
    Join Date
    Jan 2007
    Posts
    8
    You need to at least have a go yourself first. You can't just expect people to write the code for you.

    Even if you're way off, have a go, post what you've done, then maybe you'll get some help.

  6. #21
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    and buddies what is that meaning e.d
    a^b
    how does it works"^"

  7. #22
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    ya i have tried all of them by my self but failed

  8. #23
    Registered User
    Join Date
    Jan 2007
    Posts
    8
    Post your efforts.

  9. #24
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    Code:
    #include<stdio.h>
    #include<conio.h>
    #define MAXDIGITS 100
    ch_to_bignum(char *s,bignum *n);
    main()
    {
    clrscr();
    typedef struct {
    		char digits[MAXDIGITS],
    		int signbit,
    		int lastdigit,
    		}bignum;
          digits m1,m2;
    printf("enter digits");
    scanf("%c",m1);
    printf("enter 2nd digit");
    scanf("%c",m2);
    ch_to_bignum(char*s,bignum*n);
    getch();
    }
    
    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)
    }

  10. #25
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    now i have to calculate 11111111111111111111111111111000000000000000000000 00000000000023333333333+45345789999999999999999992 43214444444444444444444444444444444444444440333333 3333333 as well as"-" and "*"

  11. #26
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    Quote Originally Posted by twomers
    Try. Fail. Post code. We might fix it for you or tell you how to.

    ok i will try my best but give me some hints that how can i add long ints by taking carry

  12. #27
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    Code:
    #include<stdio.h>
    #include<conio.h>
    #include<stdlib.h>
    #include<string.h>
    
    main()
    {
    clrscr();
    int a[500];
    int b[500];
    int num1,num2,x,y,i,j,sum;
    printf("input numbers");
    scanf("%d",&a);
    printf("input 2nd numbers");
    scanf("%d",&b);
    num1=atoi(a);
    num2=atoi(b);
    printf("num1 =%d",num1);
    printf("num2 =%d",num2);
    x=strlen(a);
    y=strlen(b);
    {
    for(i=x;i>=0;i--)
    printf("\n%d",a[i]);
    }
    for(j=y;j>=0;j--)
    {
    printf("\n%d",b[j]);
    }
    sum=a[i]+b[j];
    printf("sum=%d",sum);
    getch();
    }
    this is not complete

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, 09:54 AM
  3. plz help me with simple string comparison.
    By MegaManZZ in forum C++ Programming
    Replies: 11
    Last Post: 02-18-2008, 01: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