Press any key to continue

Started by
15 comments, last by misterags 22 years, 3 months ago
cout.flush() only needs to be used if you use iostream.h
if you use iostream, and namespace std, you dont need to flush.
  #include <iostream>using namespace std;void main(){	for(int i =0; i< 100; i++)		cout << i + ''a'';	cout << "\npress any key";	getch();}//main  


if you dont want to use std, then prior to output, you can specify an ios flag, unitbuf, to flush frequently.
   cout.flags(ios::unitbuf);  
Advertisement
Well "I" personally do not like to use Namespace Std because it bloats my program size too much.
Why is that BTW?
its basicaly a shitload of code to make your life easyer

I think it has to do with using STL.. I''m not sure

The nightmare travels across the cosmos with his burning mane. The trail of ash that is produced.

?Have a nice day!?

as the guy above said, you should use kbhit or bios calls.

It stops really stupid key presses from being entered, such as escape codes. It makes a stable app - idiot proof.


Beer - the love catalyst
good ol'' homepage
Beer - the love catalystgood ol' homepage
quote:Original post by EvilCrap
cout.flush() only needs to be used if you use iostream.h
if you use iostream, and namespace std, you dont need to flush.

Sorry, no cigar.

quote:Anonymous Poster
Well "I" personally do not like to use Namespace Std because it bloats my program size too much.
Why is that BTW?

Beccause you''re not supposed to import the entire namespace. The objective of namespaces is to enable you resolve clashes as well as minimize entities brought into your translation unit. Doing
using namespace std; 
defeats the purpose and is just plain bad programming practice.

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!
Where''s the any key?

Once there was a time when all people believed in God and the church ruled. This time is called the Dark Ages.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]

This topic is closed to new replies.

Advertisement