Thread: getting an error, need help

  1. #16
    Registered User
    Join Date
    Nov 2002
    Posts
    20
    i cant find anything wrong with the if statements?

  2. #17
    Registered User
    Join Date
    Nov 2002
    Posts
    20
    yeah, it is fine, except it cant print out the actual receipt which is what the program was intended to do. i cant seem to work out how to do it either

  3. #18
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Hey, just noticed - what's this supposed to do?
    Code:
    if(product1 > "z") {...}
    It somehow doesn't look right to me... I could be wrong though.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  4. #19
    Registered User
    Join Date
    Nov 2002
    Posts
    20
    that if statement just means that if someone has written more than just "z" for the product details, that it should display those details, otherwise leave it blank. its basically a test, im not sure if its the best way of doing it though. if u can help me with it, i would really appreciate it.

  5. #20
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Somebody correct me if I'm wrong, but this is what I'm thinking it will do:

    take the value of the pointer called product1
    compare it to
    the value of a pointer to a static array of 1 character, which is "z"

    So basically, it's not really comparing the strings, but the pointers (which are sort of like integers, unless I'm wrong which is very likely). Try something like this:
    Code:
    char product[20] = {0}; // or = ""; (I'm not sure)
    (...)
    if(product[0] != '\0') {...}
    That might work better, I haven't tried it though.
    Last edited by Hunter2; 11-23-2002 at 03:33 PM.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  6. #21
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    that too
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  7. #22
    Registered User
    Join Date
    Nov 2002
    Posts
    20
    thanks a lot for that help salem, but when u press "0" to stop typing in products it doesnt display the receipt it just exits
    do u know how to fix this?

  8. #23
    Registered User
    Join Date
    Nov 2002
    Posts
    20
    excuse my dumbness but im not sure where to insert the pause code in the program

  9. #24
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Right after the receipt is printed out. Because right after that the program quits; if you pause between that and the quit, it will display then quit after the pause. Otherwise, if you put it earlier, it will pause then display it too fast for you to see and then quit.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  10. #25
    Registered User
    Join Date
    Nov 2002
    Posts
    20
    wow that works beautifully, thanks alot salem and hunter2
    ill be sure to come to u if i have any more problems

  11. #26
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    No problem

    face_master: Any day!

    heh
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  12. #27
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    lol, forgot bout this thread I spend too much time in the General Forum!

Popular pages Recent additions subscribe to a feed