not getting output

Dear sir,
I am not able to see the output of following program
#include<iostream>

int main()
{
std::cout<<"Welcome to C++";
return 0;
}
I would be glad if you can solve this problem.
With regards,
matanuragi
I presume you are using Windows and some sort of IDE?

Check out the thread at the top of this forum titled Console Closing Down.

Hope this helps.

I am using windows xp. I tried the following code

#include<iostream>
using namespace std;
int main()
{
cout<<"Welcome to C++";
return 0;
}
But it did not worked.
Thanks for your help.
With regards,
Matanuragi
closed account (z05DSL3A)
As Duoas said read the thread: Console Closing Down http://www.cplusplus.com/forum/beginner/1988/

Basically, when you run your program from the IDE, it starts a command line window runs your program then closes said window. You need to use a method that dose not end the program until the use gives some input.

In this case you could achieve this simpley as follows:
1
2
3
4
5
6
7
8
#include<iostream>
using namespace std;
int main()
{
    cout<<"Welcome to C++";
    cin.ignore();
return 0;
}
Last edited on
Topic archived. No new replies allowed.