Thread: Need a little help!!

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    it would be helpful if you show me the right printf code instead of making me confuse, don't you think?
    If that made you confused, perhaps you should consider changing field
    So, what do you find confusing? Do you understand how to use printf()?
    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
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Doink View Post
    it would be helpful if you show me the right printf code instead of making me confuse, don't you think?
    No, because giving you exactly what you ask for doesn't make YOU think. If you read the answer Laserlight gave, you shouldn't have to think very much to fix your problem.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #18
    Divine
    Join Date
    Oct 2007
    Location
    Earth(duh!)
    Posts
    20
    Quote Originally Posted by laserlight View Post
    If that made you confused, perhaps you should consider changing field
    So, what do you find confusing? Do you understand how to use printf()?

    Code:
    printf("Your balance is:%f',total_salary);
    is that the correct one?

  4. #19
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    is that the correct one?
    Almost. The problem now is one of syntax (mismatch between double quote and single quote, string literals are enclosed/delimited by double quotes only), but you would have discovered your typographical error if you compiled the code.
    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

  5. #20
    Divine
    Join Date
    Oct 2007
    Location
    Earth(duh!)
    Posts
    20
    Quote Originally Posted by laserlight View Post
    Almost. The problem now is one of syntax (mismatch between double quote and single quote, string literals are enclosed/delimited by double quotes only), but you would have discovered your typographical error if you compiled the code.
    oh yes, i noticed. it is supposed to be like this:

    Code:
    printf("Your balance is:%f",total_salary);

Popular pages Recent additions subscribe to a feed