Question: what wrong of this code? #include using namespace std; int main ( ) { / / variable declaration for the tail and head of the

what wrong of this code?
#include
using namespace std;
int main(){
//variable declaration for the tail and head of the arrow
int baseChar;
int headChar;
//accepting first integer value 0 as base character for the tail of the arrow
cin >> baseChar;
//accepting second integer value 1 as base character for head of the arrow
cin >> headChar;
//main loop that iterates 7 times
for (int x =1; x <=7; x++){
if (x <=4){
//loop for printing the space in the upper part of the arrow
for (int y =1; y <=4; y++){
//condition for printing the space in first two rows
if (x ==1|| x ==2)
cout <<"";
//condition for printing the first base character 0 for the tail of the arrow
else
cout << baseChar;
}
//condition for printing the first base character 0 for the head of the arrow
for (int y =1; y <= x; y++){
cout << headChar;
}
}
//condition for printing the space in the lower part of the arrow
else {
//loop for printing the space in the lower part of the arrow
for (int y =1; y <=4; y++){
//condition for printing the space at the 6th and 7th row along the tail of the arrow
if (x ==6|| x ==7)
cout <<"";
//condition for printing the first base character 0 in the lower part of the arrow along the tail
else
cout << baseChar;
}
//loop for printing the head character
for (int y =1; y <=7- x +1; y++){
cout << headChar;
}
}
cout << endl;
}
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!