Answer:
The code for development of this kind of arrowhead and arrow body as given in example is as below.
Step-by-step explanation:
Assumptions
- Assuming the language required is C++. As the basic outlook is similar, the syntax of specific language can be varied.
- Here 1 is used as the second digit in example. It can be replaced with any other digit depending on the input from the user.
- The concept of function is used which will be called back whenever required.
The basic definition of the code is such that the essential number of spaces, zeros and ones are estimated accurately
Code
#include<iostream>
using namespace std;
//Defining the function as arrow with inputs as x and y integer with no output.
void arrow(int x, int y);
int main() //main function where the main code is present.
{
//So variables are initialized
int x,y;
//get input from the user via keyboard.
cout<<"Enter Two Integers: \\";
cin>>x>>y; //storing integers as x and y.
//Displaying extra line at command window to get clear figure of arrow
cout<<"\\\\\\\\";
//Calling function to draw arrow
arrow(x,y);
return 0;
}
void arrow(int x, int y)
{
//1st line has 2 spaces and 1 second input number
cout<<" "<<" "<<y<<endl;
//2nd line -- 2 spaces and 2 second input number
cout<<" "<<" "<<y<<y<<endl;
//3rd line -- 5 first input and 3 second input number
cout<<x<<x<<x<<x<<x<<y<<y<<y<<endl;
//4th line -- 5 first input and 4 second input number
cout<<x<<x<<x<<x<<x<<y<<y<<y<<y<<endl;
//5th line -- 5 first input and 3 second input number
cout<<x<<x<<x<<x<<x<<y<<y<<y<<endl;
//6th line -- 2 spaces and 2 second input number
cout<<" "<<" "<<y<<y<<endl;
//7th line -- 2 spaces 1 second input number
cout<<" "<<" "<<x<<endl;
}