Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ delay

#include <iostream>
#include <unistd.h>     //required for usleep()
using namespace std;
int main(){
    //usleep will pause the program in micro-seconds (1000000 micro-seconds is 1 second)
    const int microToSeconds = 1000000;   
    const double delay1 = 2 * microToSeconds;     //2 seconds
    const double delay2 = 4.5 * microToSeconds;     //4.5 seconds
    
    cout<<"Delay 1 in progress... ("<<delay1/microToSeconds<<"s)"<<endl;
    usleep(delay1);        
    cout<<"  => Delay 1 is over"<<endl<<endl;
    
    cout<<"Delay 2 in progress... ("<<delay2/microToSeconds<<"s)"<<endl;
    usleep(delay2);
    cout<<"  => Delay 2 is over"<<endl<<endl;

    return 0;
}
Comment

time delay in c++

#include<windows.h>
Sleep(milliseconds);
Comment

c++ delay

// Arduino delay
delay("time");
// Where "time" is the delay in milliseconds
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ print number not in scientific notation 
Cpp :: how to get input in cpp 
Cpp :: integer type validation c++ 
Cpp :: array 2d dynamic allocation c++ 
Cpp :: C++ generate a random letter 
Cpp :: c++ competitive programming mst 
Cpp :: how to make for loop in c++ 
Cpp :: C++ Multi-line comments 
Cpp :: taking a vector in c++ containing element 
Cpp :: how to read a comma delimited file into an array c++ 
Cpp :: c++ print vector without loop 
Cpp :: change abstract title name latex 
Cpp :: roscpp publish int32 
Cpp :: c++ code for quicksort 
Cpp :: sort stl 
Cpp :: substring to int c++ 
Cpp :: c++ function as param 
Cpp :: c++ char it is a number 
Cpp :: file open cpp 
Cpp :: all data types in c++ 
Cpp :: max_element c++ 
Cpp :: minimum value in array using c++ 
Cpp :: ubuntu dotnet core install 
Cpp :: size of pointer array 
Cpp :: how to find 2d vector length cpp 
Cpp :: c++ inherit from class template 
Cpp :: how to find the size of a character array in c++ 
Cpp :: opencv open image c++ 
Cpp :: c++ program to print natural numbers from 1 to 10 in reverse order using while loop 
Cpp :: number of digits in int c++ 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =