#include#include using namespace std; string getName() { string name = getenv("USER"); return name; } int main() { cout << "Hello, " << getName() << "!" << endl; return 0; }
#includeThe package or library that contains the function getName may vary depending on the operating system or development environment being used. In Unix-based systems, it may be included in the cstdlib library.#include using namespace std; string getName() { string name = getenv("USER"); return name; } void displayMessage(string name) { cout << "Hi " << name << "! Welcome to our program." << endl; } int main() { string name = getName(); displayMessage(name); return 0; }