People are mentioning that my question isn't clear enough so hopefully to make it easier for everyone I'm going to restructure it.
The code below is designed to print a function that creates an arrow made out of '*' for example:
1.__*
2._* * *
3.* * * * *
4.__ *
5.__ *
6.__ *
However, my arrow must be calculated from user input. The arguments of the arrow must take: The width of the arrow head, the width of the tail, length of the arrow from tail to point and the character used to draw the arrow (in this case '*')
Please take a look at the code, and then below I will post the errors I'm receiving when I try entering debug mode. I will update the code as I go along with peoples advice. Also please note I'm not an expert with C++, this is really my first task. So if you could please spell everything out for me as you would want it explained when you were a beginner. Thank you
#include <iostream>
#include <sstream>
using namespace std;
void draw_arrow(int width, int tail, int length, char draw){
for (int i = 1; i <= width; i += 2){
for (int j = 0; j<(width - i) / 2; j++) std::cout << " ";
for (int j = 0; j<(length - i) / 2; j++); std::cout << " ";
for (int j = 0; j std::cout << draw;
std::cout << "\n";
}
for (int i = 0; i < width / 2; i++){
for (int j = 0; j<(width - tail) / 2; j++)
std::cout << " ";
for (int j = 0; j<tail;> std::cout << draw;
std::cout << std::endl;
}
}
int main() {
cout << "Welcome to printArrow" << endl;
cin >> " " >> endl;
int width_of_arrow = 0;
int width_of_tail = -1;
int length_of_arrow = 0;
char drawing_char = '\0';
std::string input;
std::cout << "Please input the Width of the Arrow head: "; std::getline(std::cin, input);
std::stringstream(input) >> width_of_arrow;
std::cout << "Please input the Width of the Tail: 1";
std::getline(std::cin, input);
std::stringstream(input) >> width_of_tail;
if (width_of_tail == -1) width_of_tail = 1;
std::cout << "Please input the length of the Arrow: ";
std::getline(std::cin, input);
std::stringstream(input) >> length_of_arrow;
if (length_of_arrow == -2) length_of_tail = 2;
std::cout << "Input Drawing Character: *";
std::getline(std::cin, input);
drawing_char = input[0];
if (drawing_char == '\0') drawing_char = '*';
draw_arrow(width_of_arrow, width_of_tail, length_of_arrow, drawing_char);
return 0;
}
Error 1 error C2086: 'std::string input' : redefinition
Error 2 error C2065: 'length_of_arrow' : undeclared identifier
Error 3 error C2065: 'length_of_arrow' : undeclared identifier
Error 4 error C2065: 'length_of_arrow' : undeclared identifier
Error 5 IntelliSense: identifier "length_of_arrow" is undefined"
This may seem simple to some of you but it isn't to me so I appreciate you being understanding. Thank you for any help you can give