| | |
Please help a beginner - window closes
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Jul 2006
Posts: 7
Reputation:
Solved Threads: 0
Hi all
Any help would be much appreciated.
Im following the about.com tutorial, and one of the exercises says i should make this program;
It compiles fine; when I run it, it asks me for my name, and then id, but when i press return it just closes the window.
Ive tried adding in a
I dont understand why it wont display the text afterwards?!?
Help please for my sanity (why dont think work like on the tutorials - did people try out the programmes before putting them on?)
P.S As a an afterfthough what purpose does the
Any help would be much appreciated.
Im following the about.com tutorial, and one of the exercises says i should make this program;
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <string> using namespace std; int main () { string name; int ID; cout<<"enter your name\n"; cin>> name; cout<<"enter your id\n"; cin>> ID; cout <<"hello" <<name <<", or should i say" <<ID <<endl; return 0; }
It compiles fine; when I run it, it asks me for my name, and then id, but when i press return it just closes the window.
Ive tried adding in a
cin.get() , which resolved the problem with the hello world programme i did, but not this.I dont understand why it wont display the text afterwards?!?
Help please for my sanity (why dont think work like on the tutorials - did people try out the programmes before putting them on?)
P.S As a an afterfthough what purpose does the
endl tag serve? it doesn't seem to make a difference. One
PS http://www.parashift.com/c++-faq-lit....html#faq-15.7
Don't be rude when it is you that doesn't understand the simple things.
cin.get() grabs the leftover newline (which remains after entering a number), and a second cin.get() will actually then wait for a keypress.PS http://www.parashift.com/c++-faq-lit....html#faq-15.7
•
•
•
•
Originally Posted by Simon268
(why dont think work like on the tutorials - did people try out the programmes before putting them on?)
Last edited by Dave Sinkula; Jul 19th, 2006 at 10:05 pm.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
Similar Threads
- IE6 Browser Window closes when accessing certain websites (Web Browsers)
- Windows IE closes when I open it.... (Web Browsers)
- IE 6 only allows 1 browser open at a time!! (Web Browsers)
- IE 6.0 browser window closes on submit (Web Browsers)
Other Threads in the C++ Forum
- Previous Thread: 2d-c++ graphics guide PLZ!
- Next Thread: C++ For Loop User Response
| Thread Tools | Search this Thread |
api array based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






