#include <iostream> #include <string> using namespace std;
Say what standard-libary names we use using Std::cin;
Using Std::cout;
int main () {//ask for person ' s name cout << ' Please enter your name: ';
Read the name string name;
CIN >> name;
Build the message that we intend to write a const string greeting = "Hello," + name + "!";
The number of blanks surrounding greeting const int pad = 1;
The number of rows and columns to write const 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 input cout << Endl; Write rows rows of output//invariant:we have written r rows so far for (int r = 0; r!= rows; ++r) {string::size
_type c = 0; Invariant:we have written c characters so far at the currents row while (c!= cols) {//is It time to write the G
Reeting? 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 << "*";
else cout << "";
++c;
}} cout << Endl;
return 0; }