Displaying Shapes with As asterisks - C++ Language Basics

C++ examples for Language Basics:Console

Introduction

Write a program that prints a box, an oval, an arrow and a diamond as follows:

*********              ***                 *                 * 
*         *          *      *             ***               * * 
*         *        *         *           *****             *    * 
*         *        *         *             *              *      * 
*         *        *         *             *             *        * 
*         *        *         *             *              *      * 
*         *        *         *             *               *    * 
*         *          *      *              *                * * 
*********              ***                 *                 * 

Demo Code

#include <iostream>

int main(int argc, const char *argv[]) {
    std::cout << "*********     ***       *         *" << std::endl;
    std::cout << "*       *    *   *     ***       *  *" << std::endl;
    std::cout << "*       *   *     *   *****     *    *" << std::endl;
    std::cout << "*       *   *     *     *      *      *" << std::endl;
    std::cout << "*       *   *     *     *     *        *" << std::endl;
    std::cout << "*       *   *     *     *      *      *" << std::endl;
    std::cout << "*       *   *     *     *       *    *" << std::endl;
    std::cout << "*       *    *   *      *        *  *" << std::endl;
    std::cout << "*********     ***       *          *" << std::endl;

    return 0;/*from  w  w w.  ja v a 2 s.  co  m*/
}

Result


Related Tutorials