Output Window flashes and closes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prads
    New Member
    • Oct 2007
    • 25

    Output Window flashes and closes

    Hello,
    Though I have given getchar(); at the end of my C++ program, it displays the output but the cmd window just flashes and closes immediately. It is a huge pgm of abt 500+ lines and deals with a lot of data. So can anyone tell me how i shud retain the cmnd window so that i can know my output?? I also tried system("pause") ; but with no help. Pls tell me what has to be done?
    Thanks,
    prads
  • Studlyami
    Recognized Expert Contributor
    • Sep 2007
    • 464

    #2
    If your using Visual Studios you can debug your program and set up a breakpoint before you return 0; to see the output or you can run the program without debugging which makes you press a key to close the window.

    Comment

    • beacon
      Contributor
      • Aug 2007
      • 579

      #3
      When you tried system("pause") , are you using the using namespace std? If you aren't using that, it's been my experience that you have to type in just ("pause") without the system preceeding it.

      Comment

      • sicarie
        Recognized Expert Specialist
        • Nov 2006
        • 4677

        #4
        You could always do a "Press enter to continue" and use a cin.

        Comment

        • oler1s
          Recognized Expert Contributor
          • Aug 2007
          • 671

          #5
          When you tried system("pause") , are you using the using namespace std? If you aren't using that, it's been my experience that you have to type in just ("pause") without the system preceeding it.
          That doesn't even make sense beacon. Think about it for a moment, and ask if you don't know why it's utterly silly.

          Comment

          • beacon
            Contributor
            • Aug 2007
            • 579

            #6
            Originally posted by oler1s
            That doesn't even make sense beacon. Think about it for a moment, and ask if you don't know why it's utterly silly.
            Hey, I didn't claim to be some kind of master user...I was just offering a suggestion. I had it come up in my last semester of computer science and it worked for me. How??? Heck if I know.

            I don't know why you think it's silly and honestly I couldn't care less. Why you would contribute something like that when it's in no way helpful to the person that posted this in the first place is beyond me.

            So go ahead and explain it if it will make you feel better or it will stroke your ego to know that you know something I don't.

            Comment

            Working...