// Import the necessary libraries
include
include
// Use the standard namespace to avoid prefixing standard library elements
using namespace std;
// Define the main function, which is the entry point of the program
int main() {
// Declare variables to store the user's name and age
string name;
int age;
// Prompt the user to enter their name
cout << "Please enter your name: ";
// Read the user's input and store it in the 'name' variable
getline(cin, name);
// Prompt the user to enter their age
cout << "Please enter your age: ";
// Read the user's input and store it in the 'age' variable
cin >> age;
// Print out a greeting message with the user's name and age
cout << "Hello, " << name << "! You are " << age << " years old." << endl;
// Return an integer value to indicate the program's exit status
return 0;
}
Top comments (0)