Skip to content

Amsal10/cpp-star-patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

C++ Star Patterns Library

Open source collection of star patterns in C++ with interactive menu.

Features

  • 23 different star patterns
  • Interactive menu for pattern selection
  • Customizable pattern size
  • Number patterns included
  • Alphabet patterns included

Available Patterns

  1. Right Triangle
  2. Inverted Right Triangle
  3. Pyramid
  4. Inverted Pyramid
  5. Diamond
  6. Left Triangle
  7. Square
  8. Hollow Square
  9. Hollow Pyramid
  10. Number Pattern
  11. Number Triangle
  12. Reverse Number Pattern
  13. Floyd's Triangle
  14. Pascal's Triangle
  15. Hourglass
  16. Arrow Pattern
  17. Cross Pattern
  18. Sandglass
  19. Zigzag Pattern
  20. Rhombus
  21. Butterfly
  22. Alphabet A
  23. Heart Pattern

How to Use

Compile the Program

g++ interactive_demo.cpp patterns.cpp -o demo

Run the Interactive Demo

# Linux/Mac
./demo

# Windows
demo.exe

Using in Your Code

#include <iostream>
#include "patterns.cpp"

int main() {
    // Generate a right triangle pattern
    std::cout << rightTriangle(5) << std::endl;
    
    // Generate a pyramid pattern
    std::cout << pyramid(5) << std::endl;
    
    // Generate a number pattern
    std::cout << numberPattern(5) << std::endl;
    
    return 0;
}

Interactive Demo Instructions

  1. Compile the program with g++ interactive_demo.cpp patterns.cpp -o demo
  2. Run the executable
  3. Select a pattern number from the menu
  4. Enter the size of the pattern (or press Enter for default size)
  5. View the pattern output
  6. Choose to view another pattern or exit

Examples

Right Triangle (n=5)

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

Pyramid (n=5)

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

Diamond (n=5)

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

Heart Pattern (n=6)

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

Requirements

  • C++11 or higher
  • g++ compiler (or any C++ compiler)

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages