Question: Write a program that can print arrows of different size. Based on the below specification: 1. Minimum arrow size is 5 2. Arrows have a
Write a program that can print arrows of different size. Based on the below specification:
1. Minimum arrow size is 5
2. Arrows have a head and trunk section
3. The arrow head is in the shape of a triangle made up of stars with dots before and after the stars on each line. Size-5 arrow will have 1 star on line 1, 3 stars on line 2 and 5 stars on line 3.
4. For arrow head, each line should have equal number of dots before and after the stars. A size-10 arrow will have 4 dots, followed by 1 star, followed by 1 dot on line 1. 5. The arrow trunk is made up lines of 3 stars and equal number of dots before and after the stars on each line. A size-5 arrow will have 1 dot, 3 stars and 1 dot on each line. A size-10 arrow will have 3 dots, 3 stars and 3 dots.
6. The arrow trunk has a length equal to the arrow size. Size-5 arrow should have 5 lines. Sample main.cpp and output is provided below:
main.cpp
#include
#include "arrow.h"
using namespace std;
int main() {
Arrow a5(5);
Arrow a6(6);
Arrow a7(10);
a5.draw();
a6.draw();
a7.draw();
cout
return 0; }
Size 5 arrovw Size 6 arrow Size 10 arrow Done
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
