Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3
declare your main function like this: int main(int argc, const char * argv[]) { // some code return 0; } now, you can provide arguments to your compiled executable which you can access from within your code. without knowing your experience or needs, I'll keep it basic: argc is an integer representing the argument count. note that this count starts at 1 because your file name is considered the first argument. argv is a char array containing any additional arguments provided when the executable is launched. to give you an idea on implementing them, here's an example to put within the main function defined above. (don't forget #include<iostream> before defining the main function) for (int i = 0; i < argc; i++) { std::cout << argv[i] << "\n"; } for further information, I recommend using a search engine to look up the c++ reference and/or geeksforgeeks.
18th Dec 2019, 12:42 AM
grdr