472,791 Members | 1,126 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Complete n00b Needs Help with cout...

Hey, I'm trying to learn C++, the problem is, when I do cout << "Hello
World!"; it always opens dos and closes it to quickly to see...i know
im a total n00b, but any help?

Feb 28 '07 #1
8 1374
Ha*******@gmail.com wrote:
Hey, I'm trying to learn C++, the problem is, when I do cout << "Hello
World!"; it always opens dos and closes it to quickly to see...i know
im a total n00b, but any help?
Add some input at the end of your program to hold it. I've seen

system("pause");

proposed, but it may not work on your system. Try

std::cout << "press enter";
std::string a;
std::cin >a;

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Feb 28 '07 #2
On Feb 28, 11:15 am, HardHa...@gmail.com wrote:
Hey, I'm trying to learn C++, the problem is, when I do cout << "Hello
World!"; it always opens dos and closes it to quickly to see...i know
im a total n00b, but any help?
Sounds like you might be using Visual C++. You can also compile and
build your program from within Visual C++, then manually open a
command (console) window and run the resultant executable from there.

Feb 28 '07 #3
On Feb 28, 11:51 am, shadowman...@comcast.net wrote:
On Feb 28, 11:15 am, HardHa...@gmail.com wrote:
Hey, I'm trying to learn C++, the problem is, when I do cout << "Hello
World!"; it always opens dos and closes it to quickly to see...i know
im a total n00b, but any help?

Sounds like you might be using Visual C++. You can also compile and
build your program from within Visual C++, then manually open a
command (console) window and run the resultant executable from there.
No, I'm not using Visual C++ but thanks for the help and thanks for
the help Victor.

Feb 28 '07 #4
Victor Bazarov <v.********@comacast.netwrote:
Ha*******@gmail.com wrote:
>Hey, I'm trying to learn C++, the problem is, when I do cout << "Hello
World!"; it always opens dos and closes it to quickly to see...i know
im a total n00b, but any help?

Add some input at the end of your program to hold it. I've seen

system("pause");

proposed, but it may not work on your system. Try

std::cout << "press enter";
std::string a;
std::cin >a;
Another option that doesn't require a temporary string, but at the
expense of more typing, is:

std::cout << "press enter";
std::cin.ignore(std::numeric_limits<std::streamsiz e>::max(), '\n');

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Feb 28 '07 #5
Victor Bazarov wrote:
Try

std::cout << "press enter";
You'll never get me to respond to that, not after that John Varley
story.


Brian
Feb 28 '07 #6
Default User wrote:
Victor Bazarov wrote:
>Try

std::cout << "press enter";

You'll never get me to respond to that, not after that John Varley
story.
Let's hope not many have read it (I didn't for instance). :)

V
Feb 28 '07 #7
Victor Bazarov wrote:
Default User wrote:
Victor Bazarov wrote:
Try
>
std::cout << "press enter";
You'll never get me to respond to that, not after that John Varley
story.

Let's hope not many have read it (I didn't for instance). :)

Ah. It's a classic SF/mystery/networked AI amok story.


Brian
Feb 28 '07 #8
On Mar 1, 5:19 am, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
Add some input at the end of your program to hold it. I've seen

system("pause");

proposed, but it may not work on your system. Try

std::cout << "press enter";
std::string a;
std::cin >a;
Simpler is:
std::cin.get();
Feb 28 '07 #9

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

Similar topics

1
by: Keith H Duggar | last post by:
Hi Tad, While learning to use streams with a simple parse such as this my opinion is that you don't need the complication of a splitting function, vectors, etc. When you extract number types...
8
by: Foxy Kav | last post by:
Hi everyone, Im currently doing first year UNI, taking a programming course in C++, for one project i have to create a simple array manipulator... that i have done, but i cant figure out how to...
1
by: Patrick Parks | last post by:
hi guys, i am trying to read in CD info from a file and put it into an array, using a CD class. I have been working here for about 6-8 hours trying to get the input file into an array. i just need...
12
by: Christo | last post by:
borland c++ 5.01 character constant must be one or two characters long get this when compiling my first c++ program can anyone out there help? it is highlighting this line as the problem ...
2
by: Perrin | last post by:
Hi, I am new to these forums so I don't know if this is the appropriate place to post it, but Iam really stuck and I need help :( I have this assignment with structs in C++. basically the...
7
by: Alan | last post by:
When you use a function like I see posted here often, like: Public Function Whatever() stuff... End Function What do you actually do with that to make it run? I assumed you put it in a...
4
by: onefry | last post by:
Hey I have this prog that i'm working on, starting my first c++ class and kind of a n00b to programming here it is #include <iostream> #include <cstdlib> using namespace std;
14
by: TuperYabba | last post by:
Hello. I'm a noob. As such, I will now ask the obligatory stupid questions. Can anyone tell me how to do this??? I need to write a program that acts as a database for a CD collection, It has to...
6
by: Charles | last post by:
This is very strange. In the following program, If I type a one-word name, it works fine. Now, if I type a two-word name, the program splits the variable into two: #include <iostream> #include...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.