473,790 Members | 2,617 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1423
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...@co mcast.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.********@com acast.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_l imits<std::stre amsize>::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...@com Acast.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
1338
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 (int,float,...) from the stream it will read all appropriate digits and stop at characters such as a comma. Therefore, you can simply extract the number and then the separator. Here is a complete solution that writes the transformed string to...
8
2069
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 make the ESC key quit the called function when ever the user inputs data. The description was : ESC drops back to the main menu in case the user gets locked up or wants to start over again, ESC should provide a fool proof way to exit back to the...
1
1140
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 some help starting it. It needs to read 15 15 rows with 6 columns in each row. Any help??? thx a bunch..... #if !defined(microsoft) #include
12
2134
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 cout << "Please Enter First number: ";
2
2009
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 following situation its an administration system main function: opens a file and sends it to a boolean function that uses the struct declaration (name, lastname, birthdate etc) to read the file and give a cout of the found data. The boolean itself...
7
1629
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 module. If I do that and hit the run sub/user form button I get a popup asking me for a Macro Name. I'm not sure what to do from here.
4
10146
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
1449
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 use a class to store the CD info, has to have a file saving implemented, and must use dynamic data. Thank you for any help.
6
2281
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 <string> int main() { std::cout << "What is your name? "; std::string name;
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9021
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3703
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.