// just example for explanation :)
// vector containt strings
vector<string> USERS;
// take string from 'USERS'
// under name 'user' in each time :)
for(string user : USERS){
std::cout << user << std::endl;
}
for (int i = startPoint; i<index ; i++ // or i--){
//Do something...
}
for ( int i = 0; i < 5; i++)
{
cout << "Hello" << endl;
}
// prints hello 5 times.
for (int i = start; i < stop; i = i + step){
// statement 1
// statement 2
// etc
}
for (<exp_1>; <exp_2>; <exp_3>){
// loop body
}
for (int i=0; i<10; ++i);
// REMEMBER TO REPLACE '???'
// with the data structure to iterate on
for(int i=0; i<???; ++i) {}
for(auto it=???.begin(); it!=???.end(); ++it) {}
for(auto &obj : ???) {}
for ( initialization;condition;increment ) {
statement(s);
}
what is for in c++
#include iostream
using namespace std;
int main{
for(int i=0; i<100; i++)
{
cout<<"Hello World";
}
return 0;
}
for (int i = 0; i < 7; i++)
{
cout << i << endl;
}
Code Example |
---|
Cpp :: c++ check if char is number |
Cpp :: use ::begin(WiFiClient, url) |
Cpp :: factorial in c++ |
Cpp :: Frequency of a substring in a string C++ |
Cpp :: c++ how to make a negative float positive |
Cpp :: scan line in c++ |
Cpp :: string vector c++ |
Cpp :: copy a part of a vector in another in c++ |
Cpp :: prime numbers less than a given number c++ |
Cpp :: sleep system function linux c++ |
Cpp :: how to make a list in c++ |
Cpp :: c++ simple car game |
Cpp :: vector.find() |
Cpp :: cpp ifstream |
Cpp :: max_element c++ |
Cpp :: why are inline keyword in header c++ |
Cpp :: arduino funktion |
Cpp :: int to hex arduino |
Cpp :: combine two vectors c++ |
Cpp :: migration meaning |
Cpp :: cin.getline |
Cpp :: cpp pushfront vector |
Cpp :: string to upper c++ |
Cpp :: c++ int to char* |
Cpp :: quick sort c+++ |
Cpp :: reverse function in cpp array |
Cpp :: array to string c++ |
Cpp :: gettimeofday header file |
Cpp :: c++ builder |
Cpp :: c++ vector remove all duplicate elements |