#includeusing namespace std; int main(int argc, char* argv[]) { cout << "Number of arguments: " << argc << endl; for(int i = 0; i < argc; i++) { cout << "Argument " << i << " : " << argv[i] << endl; } return 0; }
#includeThis program checks for a specific argument ("hello") and outputs a message accordingly. The "cstring" package is used to compare the argument string with "hello". In conclusion, the packages used in the examples are the standard C++ library and the "cstring" package.#include using namespace std; int main(int argc, char* argv[]) { if(argc < 2) { cerr << "Error: No arguments provided" << endl; return 1; } string argument = argv[1]; if(argument == "hello") { cout << "Hello World!" << endl; } else { cout << "Invalid argument" << endl; } return 0; }