Archived

This topic is now archived and is closed to further replies.

frankiej

Advice needed please

Recommended Posts

Hi Everyone Ok I have started to learn c++ which I am enjoiying, I just need a couple of questions answered please. 1. Can anyone tell what the key is after the letter d in << endl; (this has been pasted as I still cant find it), it looks like the number one,I have been pressing every key on my keyboard and cant find it ( Or am I just stupid????). 2. I am using the free complier from bloodshed which is cool but when ever I Compile & Run my codes I press F10 but cant get the Dos results window to stay up long enough for me to see the outcome????? Please help this puzzled beginner Many Thanks

Share this post


Link to post
Share on other sites
I too am learning C++ AND using the same compiler .
The character after the d in endl is the letter l.
(A way to remember this is know that endl is just short for "end line")

As with the problem with DOS, there are two ways. The first(The one some beginner tutorials mention) is the long way.
This is to open the command prompt (Usually under Program:Accessories) and type the path(i.e. if you have a file named "Count" in a folder named "C++" in the C drive then you would type in :
C:\C++\Count. A MUCH easier way is what Tiffany_Smith suggested; Have an additional line at the end (BEFORE return 0; ) of your program that waits for user input. i.e.


int x;
std::cin >> x;
This will wait for the user(or in this case, the programmer) to input a value(This is where you can check the program).
After you're done, just enter a number and the number will be stored in the variable, but since return 0; is right below
cin >> x; the program will simply discard this value.
I hope that helped, good luck with programming!

"Eagles may soar, but weasels don''t get sucked into jet engines."

[edited by - AtmaStorm on April 21, 2004 8:17:10 PM]

Share this post


Link to post
Share on other sites
Also, if I remember right, you could use

system("pause");

or after including

cout<<"Press any key. . .";
getch();

Both will do the same the thing. Ah, I haven''t programming in C++ for a while. Beautiful stuff.

Share this post


Link to post
Share on other sites