473,671 Members | 2,298 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 1417
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
1331
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
2065
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
1137
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
2118
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
2002
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
1619
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
10133
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
1441
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
2273
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
8392
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
8912
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8597
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7428
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...
0
5692
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
4222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4403
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2809
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1807
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.