Command-line arguments: Difference between revisions
m
→{{header|C++}}: Minor formatting changes
m (→{{header|C++}}: Minor formatting changes) |
|||
Line 617:
Command line arguments are passed the same way as in C.
This example uses <code><iostream></code>.
<syntaxhighlight lang="cpp">#include <iostream>
int main(int argc, const char* argv[]) {
for (int i = 1; i < argc; ++i)▼
std::cout << "The argument #" << i << " is " << argv[i] << '\n';
▲ for (int i = 1; i < argc; ++i)
▲ std::cout << "the argument #" << i << " is " << argv[i] << std::endl;
}</syntaxhighlight>
|