#include <iostream>#include <string>using namespace std;//say what standard-libary names we useusing std::cin;using std::cout;int main(){//ask for person's namecout << "Please enter your name: ";//read the namestring name;cin >> name;//build the message that we intend to writeconst string greeting = "Hello, " + name + "!";//the number of blanks surrounding greetingconst int pad = 1;//the number of rows and columns to writeconst int rows = pad * 2 + 3;const string::size_type cols = greeting.size() + pad * 2 + 2;//write a blank line to separate the output from the inputcout << endl;//write rows rows of output//invariant:we have written r rows so farfor (int r = 0; r != rows; ++r){string::size_type c = 0;//invariant:we have written c characters so far in the currents rowwhile (c != cols){//is it time to write the greeting?if (r == pad + 1 && c == pad + 1){cout << greeting;c += greeting.size();}else{//are we on the border?if (r == 0 || r == rows - 1 || c == 0 || c == cols - 1)cout << "*";elsecout << " ";++c;}}cout << endl;}return 0;}