Scottmeup
0
Q:

FLUSH function in C++

// C++ program to demonstrate the  
// use of flush function 
#include <iostream> 
#include <thread> 
#include <chrono> 
using namespace std; 
int main() 
{ 
   for (int i = 1; i <= 5; ++i) 
   { 
      cout << i << " " << flush; 
      this_thread::sleep_for(chrono::seconds(1)); 
   } 
   return 0; 
} 
1
// Below is C++ program 
#include <iostream> 
#include <thread> 
#include <chrono> 
  
using namespace std; 
  
int main() 
{ 
  for (int i = 1; i <= 5; ++i) 
  { 
      cout << i << " "; 
      this_thread::sleep_for(chrono::seconds(1)); 
  } 
  cout << endl; 
  return 0; 
} 
0
// Below is C++ program 
#include <iostream> 
#include <thread> 
#include <chrono> 
  
using namespace std; 
  
int main() 
{ 
  for (int i = 1; i <= 5; ++i) 
  { 
      cout << i << " "; 
      this_thread::sleep_for(chrono::seconds(1)); 
  } 
  cout << endl; 
  return 0; 
} 
0

New to Communities?

Join the community