Thread: tiny snaf-u with a c porgram

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    48

    tiny snaf-u with a c porgram

    i got this program to work (yea!!!!!!!!!!!!!!), except there is a tiny error (for the book number and check digit the answers come out negative... how can i fix this?

    here's my code:

    /* ISBN program */

    #include <stdio.h>

    int main()
    {
    int W, XXX, YYYYY, Z;

    printf("Enter ISBN: ");
    /*changed commas for dashes*/
    scanf("%d-%d%d%d-%d%d%d%d%d-%d", &W, &XXX, &YYYYY, &Z);
    /*specified the length of the ints */
    printf("Language: %d\n", W);
    printf("Publisher: %3d\n", XXX);
    printf("Book Number: %5d\n", YYYYY);
    printf("Check Digit: %d\n", Z);

    return 0;
    }

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    scanf("%d-%d%d%d-%d%d%d%d%d-%d", &W, &XXX, &YYYYY, &Z);
    Why do you have format specifiers for ten variables, but you only read into four?

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    48
    thanx again for your help Quzah~!! (and sorry ab the double post... just wanted to fix my grammatical error ['program' not 'porgram'])

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. not able to understand this tiny tiny method
    By noobcpp in forum C++ Programming
    Replies: 5
    Last Post: 10-20-2008, 10:42 AM
  2. Please help have trouble my with porgram
    By torcoder in forum C++ Programming
    Replies: 8
    Last Post: 10-11-2006, 05:32 AM
  3. Backdooring Instantaneous Radius of Curvature & Functions
    By just2peachy in forum C++ Programming
    Replies: 8
    Last Post: 10-06-2004, 12:25 PM
  4. tiny error with C Program
    By JohnMayer in forum C Programming
    Replies: 4
    Last Post: 07-11-2002, 03:09 AM
  5. How to define a tiny data size in C
    By dv007 in forum C Programming
    Replies: 0
    Last Post: 06-05-2002, 03:23 PM