I wanted to post this because I was not sure if I had a problem with a simple assignment operation. I am doing my homework, which asks me to write structures and functions in a simple program to draw shapes of ASCII characters. Now I'm just trying to check the functions I wrote, and I'm trying to assign a value to the symbol element of the Circle structure in order to check the DrawShape function that I wrote. When I try to assign it * char, I get the error message "error: invalid conversion from" const char * 'to' char '". I will put all the code, although it is very long and incomplete. Any help with this would be appreciated The problem I get is right at the beginning of main on "circle1.char = '*'"
#include <iostream> #include <math.h> #include <cstdlib> using namespace std; const int NUMBER_OF_ROWS = 26; const int NUMBER_OF_COLUMNS = 81; char drawSpace[NUMBER_OF_ROWS][NUMBER_OF_COLUMNS]; struct Point{ int x; int y; }; struct Circle{ Point center; int radius; char symbol; bool buffer[NUMBER_OF_ROWS][NUMBER_OF_COLUMNS]; }; bool setCircleRadius(Circle &b, int r); bool setCircleCenter(Circle &b, int x, int y); bool moveCircle(Circle &b, int x, int y); void drawCircle (Circle b); void lineChars(Line a); void circleChars(Circle b); void drawShapes(); int main() { Circle circle1; circle1.radius = 5; circle1.symbol = "*"; circle1.center.x = 40; circle1.center.y = 10; drawCircle(circle1); return 0; }
source share