Print Friendly and PDF
(Displaying Shapes with Asterisks) Write a program that prints a box, an oval, an arrow and a diamond as follows:
(Displaying Shapes with Asterisks) Write a program that prints a box, an oval, an arrow and a diamond as follows:

Solution: 

 
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
 
int main()
{
   cout << "*********\n"
      << "*       *\n"
      << "*       *\n"
      << "*       *\n"
      << "*       *\n"
      << "*       *\n"
      << "*       *\n"
      << "*       *\n"
      << "*********\n";
   cout << "   ***   \n"
      << " *     * \n"
      << "*       *\n"
      << "*       *\n"
      << "*       *\n"
      << "*       *\n"
      << "*       *\n"
      << " *     * \n"
      << "   ***   \n";
   cout << "    *    \n"
      << "   ***   \n"
      << "  *****  \n"
      << "    *    \n"
      << "    *    \n"
      << "    *    \n"
      << "    *    \n"
      << "    *    \n"
      << "    *    \n";
   cout << "    *    \n"
      << "   * *    \n"
      << "  *   *   \n"
      << " *     *  \n"
      << "*       * \n"
      << " *     *  \n"
      << "  *   *   \n"
      << "   * *    \n"
      << "    *    \n";
 
   return 0;
}
 
 
zubairsaif

Zubair saif

A passionate writer who loves to write on new technology and programming

Post A Comment:

1 comments:

  1. Per book instructions: The shapes should be displayed horizontally.

    ReplyDelete