fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. // Function to print the Om pattern
  7. void printOmPattern(const vector<vector<char>>& pattern) {
  8. // Iterate through each row of the pattern
  9. for (const auto& row : pattern) {
  10. // Iterate through each character in the row and print it
  11. for (char ch : row) {
  12. cout << ch;
  13. }
  14. // Move to the next line after each row
  15. cout << endl;
  16. }
  17. }
  18.  
  19. int main() {
  20. // Define the Om pattern using a 2D vector of characters
  21. vector<vector<char>> omPattern = {
  22. {' ', ' ', '*', '*', '*', ' ', ' ', '*', '*', '*', ' '},
  23. {' ', '*', ' ', ' ', ' ', '*', '*', ' ', ' ', ' ', '*'},
  24. {'*', ' ', '*', ' ', ' ', '*', '*', ' ', ' ', ' ', '*'},
  25. {'*', ' ', '*', '*', '*', ' ', '*', '*', '*', '*', ' '},
  26. {'*', ' ', ' ', ' ', '*', ' ', ' ', ' ', '*', ' ', '*'},
  27. {' ', '*', '*', '*', ' ', ' ', '*', '*', ' ', '*', ' '}
  28. };
  29.  
  30. // Call the function to print the Om pattern
  31. printOmPattern(omPattern);
  32.  
  33. return 0;
  34. }
  35.  
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
  ***  *** 
 *   **   *
* *  **   *
* *** **** 
*   *   * *
 ***  ** *