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++ count vector elements 
Cpp :: c++ if statement 
Cpp :: create a vector of size n in c++ 
Cpp :: full implementation of binary search tree in C++ 
Cpp :: adding variables c++ 
Cpp :: what is function c++ 
Cpp :: vector::at() || Finding element with given position using vector in C++ 
Cpp :: struct node 
Cpp :: age in days in c++ 
Cpp :: how to increase array memory in c++ 
Cpp :: c++ compare type 
Cpp :: c++ split string 
Cpp :: assignment operator with pointers c++ 
Cpp :: Arduino Real TIme Clock 
Cpp :: how to find size of int in c++ 
Cpp :: compare values within within a vector c++ 
Cpp :: order 2d array in c++ 
Cpp :: c++ else if 
Cpp :: abs c++ 
Cpp :: binary to decimal 
Cpp :: max and min function in c++ 
Cpp :: remove duplicates from sorted list leetcode solution in c++ 
Cpp :: error: ‘CV_WINDOW_AUTOSIZE’ was not declared in this scope 
Cpp :: gtest assert not equal 
Cpp :: how to scan vector in c++ 
Cpp :: c++ exeption handling 
Cpp :: stricmp CPP 
Cpp :: sfml thread multi argument function 
Cpp :: is obje file binary?? 
Cpp :: c++ terinary operator 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =