Search for tag: "loop"
Vector, Part 2) Iterate over contents of vector in C++#include <iostream>#include <vector> using std::cout; using std::vector; int main() { auto my_data = vector<int>{17, 25, -300, 14}; for (auto item : my_data) { …
From Lane Schwartz
8 plays
0
|
|
Command line arguments in C++#include <iostream> int main(int argc, char** argv) { for (int n{0}; n <= argc; n += 1) { std::cout << argv[n] << '\n'; } return 0; }
From Lane Schwartz
2 plays
0
|
|
Basic for loop in C++#include <iostream> int main() { for (int n{10}; n > 0; n = n - 1) { std::cout << n << "\n"; } }
From Lane Schwartz
1 plays
0
|