Created
August 26, 2020 23:57
-
-
Save ampulhetadosaber/f760860f1b428621314f57e5308e1c96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector<int> I; | |
I.push_back(10); | |
I.push_back(17); | |
I.push_back(0); | |
I.push_back(-15); | |
for(int i = 0; i < I.size() ; i++) | |
{ | |
// seu código | |
} | |
// Do c++11 em diante, também podemos fazer: | |
for(auto u: I) | |
{ | |
// seu código | |
// Vale lembrar que ao fazermos isso, u vai guardar os valores, mas não conseguimos | |
// saber em qual iteração do for estamos, para isso precisariamos percorrer o vector | |
// do jeito acima | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment