Visual C++

Moderators: Lundin
Number of threads: 373
Number of posts: 687

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Problem beginning a console application Posted by Fraaaaag on 24 Mar 2009 at 12:11 PM
Hi, I just created a win32 console application with VC++6 and debugged it.
#include <iostream>
using namespace std;

int main()
{
   cout << "b";               // Start output on a new line
  return 0;
}

When I run it, the msdos command line appears for a second, does nothing, and then disappears. Does anyone know why that is, or how to fix it?

Any help is appreciated!
Report
Re: Problem beginning a console application Posted by anthrax11 on 24 Mar 2009 at 2:23 PM
The program does what it's supposed to, which is to print a text and exit. If you need to wait for a keypress, add "cin.get();".
Report
Re: Problem beginning a console application Posted by Fraaaaag on 24 Mar 2009 at 2:57 PM
It doesn't print anything, though.
Report
Re: Problem beginning a console application Posted by anthrax11 on 24 Mar 2009 at 3:58 PM
Works fine here. I've no idea what the problem might be.
Report
Re: Problem beginning a console application Posted by yby538 on 24 Mar 2009 at 8:11 PM
You can have a try to add a function call ,like this :

#include<iostream>
#include<stdlib>
using namespace std;
int main()
{
cout<<"b"<<endl;
system("PAUSE");//I am sure it can used in C,but as C++,I am not sure
return 0;
}




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.