Tuesday 21 July 2020

15. 2.21 (Displaying Shapes with Asterisks) Write a program that prints a box, an oval, an arrow and a diamond

15. 2.21 (Displaying Shapes with Asterisks) Write a program that prints a box, an oval, an arrow and a diamond 
#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;
}

No comments:

Post a Comment