473,406 Members | 2,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

OUTPUT HELLO

Hi every one.

The famous Hello code below written by C++. through its mother program
"Visual studio 2005"

When I make copy to all files of this program and click on .EXE file away
from the mother program, the output disappears immediately.

Can any person add a line (may related to" Keypress", so that the output can
stay without disappearing?

Thank to all.

-----------------------------------------------------

#include<iostream>

using std::cout;

using std::endl;

int main()

{

cout<< " HELLO WORLD ";

cout<<endl;

return 0;

}
Jun 19 '07 #1
11 2038
On Jun 19, 10:50 am, "Hello" <f...@alphalink.com.auwrote:
Hi every one.

The famous Hello code below written by C++. through its mother program
"Visual studio 2005"

When I make copy to all files of this program and click on .EXE file away
from the mother program, the output disappears immediately.

Can any person add a line (may related to" Keypress", so that the output can
stay without disappearing?

Thank to all.

-----------------------------------------------------

#include<iostream>

using std::cout;

using std::endl;

int main()

{

cout<< " HELLO WORLD ";

cout<<endl;

return 0;

}
Seems this is not really a C++ languge question.
When you double click from explorer, you are creating a console mode
application which end when your program returns. While you executing
program from Visual C++ IDE, the application spawned by vcspawn.exe
which will wait for a user input to exit. i dont know why they
required it while execute program directly from Visual Studio.
You have to call

Jun 19 '07 #2
"Hello" <fa***@alphalink.com.auwrote in message
news:46********@news.chariot.net.au...
Hi every one.

The famous Hello code below written by C++. through its mother program
"Visual studio 2005"

When I make copy to all files of this program and click on .EXE file away
from the mother program, the output disappears immediately.

Can any person add a line (may related to" Keypress", so that the output
can
stay without disappearing?

Thank to all.

-----------------------------------------------------

#include<iostream>
#include <string>
using std::cout;

using std::endl;

int main()

{

cout<< " HELLO WORLD ";

cout<<endl;
std::string wait;
std::getline( std::cin, wiat );
return 0;

}
There is another easier way that doesn't require you to create a
std::string, but I can't remember it. cin.somethingorother();
Jun 19 '07 #3
"Hello" writes:
The famous Hello code below written by C++. through its mother program
"Visual studio 2005"

When I make copy to all files of this program and click on .EXE file away
from the mother program, the output disappears immediately.

Can any person add a line (may related to" Keypress", so that the output
can
stay without disappearing?

Thank to all.

-----------------------------------------------------

#include<iostream>

using std::cout;

using std::endl;

int main()

{

cout<< " HELLO WORLD ";

cout<<endl;
add this line:

cin.get();
return 0;

}


Jun 19 '07 #4
Hello wrote:
Hi every one.

The famous Hello code below written by C++. through its mother program
"Visual studio 2005"

When I make copy to all files of this program and click on .EXE file away
from the mother program, the output disappears immediately.

Can any person add a line (may related to" Keypress", so that the output can
stay without disappearing?

Thank to all.

-----------------------------------------------------

#include<iostream>

using std::cout;

using std::endl;

int main()

{

cout<< " HELLO WORLD ";

cout<<endl;

return 0;

}

start->run->(type 'cmd')->
(go to the directory where your .exe is)->(execute it)
Jun 19 '07 #5
Bah. Visual Studio 2005 is not a mother program. I recommend not using
it because Microsoft screwed up the c++ language. I used to be happy
programming with Turbo c++ 3.0. Those were the days. Microsoft decided
to come along and make their _interpretation_ of c++. Bah I say. Give
me CONIO.H. That's right. Microsoft doesn't work with conio. Why?
'Cause they don't. That simple. They just chose not to implement it.

/end rant

Jun 19 '07 #6
RG******@gmail.com wrote:
Bah. Visual Studio 2005 is not a mother program. I recommend not using
it because Microsoft screwed up the c++ language. I used to be happy
programming with Turbo c++ 3.0. Those were the days. Microsoft decided
to come along and make their _interpretation_ of c++. Bah I say. Give
me CONIO.H. That's right. Microsoft doesn't work with conio. Why?
'Cause they don't. That simple. They just chose not to implement it.
Which is fine and dandy because conio.h isn't part of standard C++.

--
Ian Collins.
Jun 19 '07 #7
On 2007-06-19 03:50, Hello wrote:
Hi every one.

The famous Hello code below written by C++. through its mother program
"Visual studio 2005"

When I make copy to all files of this program and click on .EXE file away
from the mother program, the output disappears immediately.

Can any person add a line (may related to" Keypress", so that the output can
stay without disappearing?

Thank to all.

-----------------------------------------------------

#include<iostream>

using std::cout;

using std::endl;

int main()

{

cout<< " HELLO WORLD ";

cout<<endl;

return 0;

}
There are two ways to do this, the first is to modify the program
(adding the std::cin.get() call). However I'm not very fond of this
method since it changes to program and gives it a behaviour that you
might not want when you start using it in real life. What you can do,
which does not require any changes to the code, is to run it from the
Visual Studio environment by pressing Ctrl+F5.

--
Erik Wikström
Jun 19 '07 #8
On Tue, 19 Jun 2007 11:50:38 +1000 in comp.lang.c++, "Hello"
<fa***@alphalink.com.auwrote,
>When I make copy to all files of this program and click on .EXE file away
from the mother program, the output disappears immediately.
Do not "click on" anything. Type the name of the program as a command
to the command line shell.
Jun 19 '07 #9
Jim Langston <ta*******@rocketmail.comwrote:
"Hello" <fa***@alphalink.com.auwrote in message
news:46********@news.chariot.net.au...
>Hi every one.
When I make copy to all files of this program and click on .EXE file away
from the mother program, the output disappears immediately.

Can any person add a line (may related to" Keypress", so that the output
can
stay without disappearing?

#include <string>
[snip]
>
std::string wait;
std::getline( std::cin, wiat );

There is another easier way that doesn't require you to create a
std::string, but I can't remember it. cin.somethingorother();
It's a little more verbose, but it's cin.ignore(). Usage is shown
below.
#include <iostream>
#include <limits>

int main()
{
using std::cin;
using std::cout;
using std::numeric_limits;
using std::streamsize;

cout << "Press <Enterto continue...\n";
cin.ignore(numeric_limits<streamsize>::max(), '\n');
}
--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Jun 19 '07 #10
On Jun 19, 3:50 am, "Hello" <f...@alphalink.com.auwrote:
cout<<endl;

return 0;
Easyest was to do so is to put
System( "pause" );
betrween the two commands above.
Note that this is M$ specific, so I strongly suggest to use the
solutions in the other replies!

peace

Jun 20 '07 #11
On Jun 18, 11:13 pm, RGamb...@gmail.com wrote:
Bah. Visual Studio 2005 is not a mother program. I recommend not using
it because Microsoft screwed up the c++ language. I used to be happy
programming with Turbo c++ 3.0. Those were the days. Microsoft decided
to come along and make their _interpretation_ of c++. Bah I say. Give
me CONIO.H. That's right. Microsoft doesn't work with conio. Why?
'Cause they don't. That simple. They just chose not to implement it.

/end rant
Have you even used Visual Studio 2005, or are you just rehashing your
thoughts over Visual C++ 5.0? What parts of their interpretation of
the C++ Standard did they fail so hard in that you prefer Turbo C++
3.0 over it?
To the OP,

cin.get();

is the simplest, least verbose way to achieve the desired affect.

Jun 20 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mark Wilson CPU | last post by:
This must be easy, but I'm missing something... I want to execute a Perl script, and capture ALL its output into a PHP variable. Here are my 2 files: -------------------------------------...
5
by: Hal Vaughan | last post by:
I have a Java program, composed of a number of classes, that I've been running as a command line program. It logs everything it does and, as it logs each event, it also prints that line of info to...
0
by: B.Sathish Kumar | last post by:
hi, i tried to install Visual Studio .NET 2002. .NET Framework Version is 1.0.3705, IIS 5 in Windows 2000 Professional SP4. after installing, ASPX files gives header like output (shown below) in...
1
by: noleander | last post by:
Hi. I've got a C++ program written in Visual C++ 2003. The program is trivial, created with the Program-creation wizard: used the .NET "Form" template. The program has a trivial...
9
by: Diane | last post by:
Could you please explain me how can I output nested strings? Here is an example: "adsd{rfkm}xcv" The output should start from the inner parentheses, such as: dfF rfkm
4
by: garyusenet | last post by:
Hi. I am trying to learn about array lists, and found an example on MSDN. I tried to compile it but it's not producing any output. I can't see why. Any ideas? Here is what I did. 1....
16
by: liking C lang. | last post by:
How to write a C programming that it may output the char one after one every other second? For example: char a="hello world!" output h,next second output e,next second output l...
0
by: jebbyleezer | last post by:
Hello, I have source code that builds correctly, however, after the program terminates the output file produced is empty. Here is my source code: import java.io.*; import java.util.Scanner;...
6
by: =?Utf-8?B?R3JlZw==?= | last post by:
I am using the following command to output my results to the Output window (for testing things out). Console.WriteLine ("Output") I'd like to clear the Output window of any previous output. I...
3
by: leesquare | last post by:
Hello, I need some help getting output values from my stored procedures when using adodbapi. There's an example testVariableReturningStoredProcedure in adodbapitest.py, and that works for my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.