Thread: Exception issue

  1. #91
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    Okay. Wow.

    I'm not reading through all of that code, and I'm sure this has been said, but it could stand repeating: start with a clean source file adding only a little back, compiling each addition, until you find where your bug lives.

    Or, you know, post the example as you've been asked.

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  2. #92
    Registered User
    Join Date
    Jul 2013
    Posts
    158
    Quote Originally Posted by phantomotap View Post
    O_o

    Okay. Wow.

    I'm not reading through all of that code, and I'm sure this has been said, but it could stand repeating: start with a clean source file adding only a little back, compiling each addition, until you find where your bug lives.

    Or, you know, post the example as you've been asked.

    Soma
    I asked for "how to use std instead od declaring it "using namespace std" and also whether std::setw is correct or not as its not working for me ...even if you write std:: and see the drop down menu provided by compiler environment you didn't see such a STUFF........
    WHAT you Suggested is am doing already
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  3. #93
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by jeedi khan
    I asked for "how to use std instead od declaring it "using namespace std"
    You've done that before, at least within your post, e.g., use std::setw instead of setw. Still, it would be better to figure out why the name is ambiguous in the first place rather than blindly fully qualifying the name.

    Quote Originally Posted by jeedi khan
    whether std::setw is correct or not as its not working for me
    How does it not work?

    Quote Originally Posted by jeedi khan
    WHAT you Suggested is am doing already
    Not likely:
    Quote Originally Posted by phantomotap
    start with a clean source file adding only a little back, compiling each addition, until you find where your bug lives.
    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

  4. #94
    Registered User
    Join Date
    Jul 2013
    Posts
    158
    Quote Originally Posted by laserlight View Post


    How does it not work?














    std::setw is correct or not as its not working for me ...even if you write std:: and see the drop down menu provided by compiler environment you didn't see such a STUFF........
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  5. #95
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by jeedi khan
    std::setw is correct or not as its not working for me ...even if you write std:: and see the drop down menu provided by compiler environment you didn't see such a STUFF........
    Maybe your "compiler environment" is broken or its internal state was not updated to include the symbol somehow. Maybe you just didn't see the "STUFF". Maybe when removing the unnecessary headers, you accidentally removed <iomanip> (or rather did not move it to the source file). Maybe, maybe, maybe.

    What is the current code, particularly the line that contains the setw call? What's the error message? What's the incorrect output? As long as you don't say that, just saying "its not working for me" is not very useful. I can only tell you: go and fix it.

    Put it another way. Compile and run this program:
    Code:
    #include <iostream>
    #include <iomanip>
    
    int main()
    {
        using namespace std;
        int x = 123;
        cout << setfill('0') << setw(4) << x << endl;
    }
    What error messages do you get? If it compiles, what is the output?
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Exception errors OR exception handling :S
    By cruiser in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2011, 05:30 AM
  2. bandwidth issue / network issue with wireless device communication
    By vlrk in forum Networking/Device Communication
    Replies: 0
    Last Post: 07-05-2010, 11:52 PM
  3. Handle C++ exception and structured exception together
    By George2 in forum C++ Programming
    Replies: 2
    Last Post: 01-24-2008, 09:21 PM
  4. R/W to 0x0 exception how to????
    By symptom in forum C Programming
    Replies: 2
    Last Post: 06-07-2005, 10:59 AM
  5. An "throwing exception" issue
    By viniciusMarques in forum Windows Programming
    Replies: 3
    Last Post: 06-02-2004, 10:38 AM