(Letter Pyramid) Write a program that generates the following from the string "abcdef- ghijklmnopqrstuvwxyz{":

![14908|211x203](upload://kfNQPkz0aSqSetXcxUK3CDJwoZx.png)


```
// Program prints a pyramid from a string.
#include
#include
using namespace std;

int main()
{
string alpha = "abcdefghijklmnopqrstuvwxyz{";
string::const_iterator x = alpha.begin();
string::const_iterator x2;

for ( int p = 1; p <= 14; p++ )
{
int w; // index variable
int count = 0; // set to 0 each iteration

// output spaces
for ( int k = 13; k >= p; k-- )
cout << ' ';

x2 = x; // set starting point

// output first half of characters
for ( int c = 1; c <= p; ++c )
{
cout << *x2;
++x2; // move forward one letter
++count; // keep count of iterations
} // end for

// output back half of characters
for ( w = 1, x2 -= 2; w < count; w++ )
{
cout << *x2;
--x2; // move backward one letter
} // end for

++x; // next letter
cout << '\n';
} // end for
} // end main
```
![14909|217x210](upload://AnrrH586dTsLBCLbIUBMDBJc4hO.png)

Computer Science & Information Technology

You might also like to view...

You decide to conduct a series of JAD sessions. Prepare a memo to participants, and include adetailed plan.

What will be an ideal response?

Computer Science & Information Technology

____ is the process of changing or intensifying the color of a photograph after it has been processed by the camera.

a. Montage b. Grayscale c. Color toning d. Repurposing

Computer Science & Information Technology

What happens when a cable breaks in a star topology network?

What will be an ideal response?

Computer Science & Information Technology

A relative cell reference is a reference based on the relative position of a cell that contains the formula and the cells referred to in the formula

Indicate whether the statement is true or false.

Computer Science & Information Technology