Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Range List for C++
// Range List for C++ #include <iostream> #include <vector> #include <cmath> #include <numeric> using namespace std; int main(){ int a=1,b=20,c=3; vector<int> rng(ceil((float)(b-a)/c)); iota(rng.begin(),rng.end(),0); for(auto &i:rng) i=a+i*c; for(auto i:rng){ cout<<i<<endl; } return 0; }
run
|
edit
|
history
|
help
0
numeric_limits
hello world
10226
Variable declarations in while loop conditions are also C++-only.
pack expansion
Dynamic call
Tilted uniform distribution random number generator over min/max range
List comprehension in C++ using functional patterns
Dash-D compiler flag example
the usual name hiding rules do apply with using directives