
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
Write a program for Happy Woman’s Day in c++
The woman day which is celebrated on 7th October worldwide is carved into a c++ programming code as following;
Example
#include <iostream> using namespace std; int main(){ // Initializing size of // design int n = 5; // Loop to print Circle // (Upper part of design) // Outer loop to // control height of // design for (int i = 0; i <= 2 * n; i++) { // Inner loop to control // width if (i == n) cout << " "<< "7 Oct"; for (int j = 0; j <= 2 * n; j++) { // computing distance of // each point from center float center_dist = sqrt((i - n) * (i - n) + (j - n) * (j - n)); if (center_dist > n - 0.5 && center_dist < n + 0.5) cout << "#"; else cout << " "; } // Printing HappY Women's DaY if (i == n) cout << " "<< "Happy Women's Day"; cout << endl; } // Loop to print lower part // Outer loop to control // height for (int i = 0; i <= n; i++) { // Positioning pattern // Loop for Printing // horizontal line if (i == (n / 2) + 1) { for (int j = 0; j <= 2 * n; j++) if (j >= (n - n / 2) && j <= (n + n / 2)) cout << "*"; else cout << " "; } else { for (int j = 0; j <= 2 * n; j++) { if (j == n) cout << "*"; else cout << " "; } } cout << endl; } }
Output
The program yields the following output after the compilation of the above code as follows;
- Related Articles
- What's the best way to ensure a happy marriage?
- C++ program to print Happy Birthday
- Can being a woman becomes a ground for lesser punishment?
- Write a program for Linear Search in Python
- Write a program in Python to print the day of the year in a given date series
- Java Program to get day of week for the last day of each month in 2019
- Happy Hormones
- What are the diet restrictions for a woman with gestational diabetes?
- Happy Number in Python
- Happy Numbers in Python
- MySQL's now() +1 day?
- The Happy Prince
- Longest Happy String in C++
- Longest Happy Prefix in C++
- Write a C program for guessing the number game.

Advertisements