eratosthenis sieve in c++
C++
void eratosthenes_sieve(int N){
bool primes[N+1];
memset(primes, true, sizeof(primes));
primes[0] = false;
primes[1] = false;
for (int p=2; p*p<=N; p++){
if (primes[p]){
for (int i=p*2; i<=N; i+=p)
primes[p] = false;
}
}
}
Also in C++:
- Title
- time function c++
- Category
- C++
- Title
- flake8 max line length
- Category
- C++
- Title
- first prime numbers
- Category
- C++
- Title
- how to load from files C++
- Category
- C++
- Title
- c++ class member initialization
- Category
- C++
- Title
- calling a method on an object c++
- Category
- C++
- Title
- how to type cast quotient of two integers to double with c++
- Category
- C++
- Title
- rgb(100,100,100,0.5) validation c++
- Category
- C++
- Title
- never gonna give you up lyrics
- Category
- C++
- Title
- c++ initialization list
- Category
- C++
- Title
- opperanf >> c++
- Category
- C++
- Title
- iostream library in cpp
- Category
- C++
- Title
- what is meaning of 64 bit integer in c++
- Category
- C++
- Title
- c++ unittest in ros
- Category
- C++
- Title
- c++ string to vector int
- Category
- C++
- Title
- convert string to stream c++
- Category
- C++
- Title
- mkdir c++
- Category
- C++
- Title
- c++ for loop
- Category
- C++
- Title
- how to run c++ file mingw cmd
- Category
- C++
- Title
- c++ while loop code
- Category
- C++
- Title
- hobo 8
- Category
- C++
- Title
- error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if(s[i] != "b"){
- Category
- C++
- Title
- c++ switch case statement
- Category
- C++
- Title
- console colors in C++
- Category
- C++
- Title
- arduino falling edge
- Category
- C++
- Title
- shortest path with bfs in c++
- Category
- C++
- Title
- c++ multiple inheritance diamond problem
- Category
- C++
- Title
- for loop
- Category
- C++
- Title
- c++ how to add something at the start of a vector
- Category
- C++
- Title
- nearest integer rounding in c++
- Category
- C++
- Title
- convert GLFWwindow* to IntPtr
- Category
- C++
- Title
- how the theam are store in database
- Category
- C++
- Title
- adding element in vector c++
- Category
- C++
- Title
- tuple c++
- Category
- C++
- Title
- how to make string get spaces c++
- Category
- C++
- Title
- c++ files
- Category
- C++
- Title
- c++ typedef
- Category
- C++
- Title
- c++ give options
- Category
- C++
- Title
- preorder traversal
- Category
- C++
- Title
- longest common subsequence
- Category
- C++
- Title
- decimal to hex cpp
- Category
- C++
- Title
- c++ vector iterator
- Category
- C++
- Title
- newline in c++
- Category
- C++
- Title
- c++ vector add element
- Category
- C++
- Title
- first fit algorithm
- Category
- C++
- Title
- initialize map c++
- Category
- C++
- Title
- matrix transpose tiling
- Category
- C++
- Title
- c++ while true
- Category
- C++
- Title
- lopping over an array c++
- Category
- C++
- Title
- how to modulo 10^9+7
- Category
- C++
- Title
- how to cout in c++
- Category
- C++
- Title
- how to switch to another branch in git
- Category
- C++
- Title
- command line options in c++
- Category
- C++
- Title
- calculate factorial
- Category
- C++
- Title
- how to iterate over unordered_map c++
- Category
- C++
- Title
- euler's totient function c++
- Category
- C++
- Title
- two sum problem in c++
- Category
- C++
- Title
- c++ crash windows
- Category
- C++
- Title
- c++ wait for user input
- Category
- C++
- Title
- in c, is class uppercase or lowercase
- Category
- C++
- Title
- simple timer arduino blynk library error
- Category
- C++
- Title
- c++ convert int to cstring
- Category
- C++
- Title
- c++ movment
- Category
- C++
- Title
- how to measure program run time in c++
- Category
- C++
- Title
- string to vector c++
- Category
- C++
- Title
- initialise 2d vector in c++
- Category
- C++
- Title
- reverse a linked list using recursion
- Category
- C++
- Title
- singleton c++
- Category
- C++
- Title
- initialize vector of pointers c++
- Category
- C++
- Title
- c++ isalphanum
- Category
- C++
- Title
- c++ how to return an empty vector
- Category
- C++
- Title
- c++ excel cell blank cells
- Category
- C++
- Title
- pair in c++
- Category
- C++
- Title
- how to declare a vector in c++
- Category
- C++
- Title
- phph date
- Category
- C++
- Title
- 1d fixed length arrays c++
- Category
- C++
- Title
- maximum subarray sum equal with K in c++
- Category
- C++
- Title
- unordered_set c++
- Category
- C++
- Title
- sort a pair using c++ stl
- Category
- C++
- Title
- string comparison in c++
- Category
- C++
- Title
- pyqt connect
- Category
- C++
- Title
- how do for loops on c++
- Category
- C++
- Title
- c++ empty stream
- Category
- C++
- Title
- c++ std::copy to cout
- Category
- C++
- Title
- c++ code for polynomial addition
- Category
- C++
- Title
- calling by reference c++
- Category
- C++
- Title
- run program until ctrl-d c++
- Category
- C++
- Title
- c++ while true loop
- Category
- C++
- Title
- c++ transform
- Category
- C++
- Title
- how to output to console c++
- Category
- C++
- Title
- sorting of array in c++
- Category
- C++
- Title
- c++ sort array of ints
- Category
- C++
- Title
- can you use a return to print a string when referencing an integer c++
- Category
- C++
- Title
- object reference not set to an instance of an object c#
- Category
- C++
- Title
- variabvles in c++
- Category
- C++
- Title
- how to find the size of a character array in c++
- Category
- C++
- Title
- c++ pointers
- Category
- C++
- Title
- pop from between string c++
- Category
- C++
- Title
- c++ find object in vector by attribute
- Category
- C++
- Title
- min in vector c++
- Category
- C++