logo CodeStepByStep logo

nameDiamond

Language/Type: C++ string parameters
Related Links:

Write a function named nameDiamond that accepts a string as a parameter and prints it in a "diamond" format as shown below. For example, the call of nameDiamond("MARTY"); should print:

M
MA
MAR
MART
MARTY
 ARTY
  RTY
   TY
    Y
Function: Write a C++ function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.