Question: help fix my code: #include asciigen.h #include #include using namespace std; / / * * * * * * * * * * *
help fix my code:
#include "asciigen.h
#include
#include
using namespace std;
private functions
Prints the title centered in a DIM width
void printtitleconst char title ostream &out
int len staticcaststrlentitle;
int offset DIM len ;
char centredDIM; for null terminator
for int i ; i DIM ; i
centredi;
strncpycentred offset, title, len;
out centred endl;
Copies the contents of rhs to art
void copychar artDIMDIM const char rhsDIMDIM
for int r ; r DIM; r
for int c ; c DIM; c
artrc rhsrc;
Get the pixel value at the given position.
Returns empty if out of bounds.
char getconst char artDIMDIM int x int y
char value EMPTY;
if x && x DIM && y && y DIM
value artyx;
return value;
public functions
void printconst char artDIMDIM const char title std::ostream &out
printtitletitle out;
for int r ; r DIM; r
out ;
for int c ; c DIM; c
out artrc;
out endl;
void initchar artDIMDIM
for int r ; r DIM; r
for int c ; c DIM; c
artrc EMPTY;
void drawcirclechar artDIMDIM int radius, int x int y
for int r ; r DIM; r
for int c ; c DIM; c
if c xc xr yr y radius radius
artrc FILL;
void drawrectanglechar artDIMDIM int width, int height, int x int y
for int r y; r y height && r DIM; r
for int c x; c x width && c DIM; c
if r && c
artrc FILL;
void drawequilateralchar artDIMDIM int side, int x int y
int height staticcastsqrt side;
int halfwidth side ;
for int row ; row height && y row DIM; row
int rowstart x row halfwidth height;
int rowend x row halfwidth height;
for int col rowstart; col rowend && col DIM; col
if col && y row
arty rowcol FILL;
void calcunionchar lhsDIMDIM const char rhsDIMDIM
for int r ; r DIM; r
for int c ; c DIM; c
if rhsrc FILL
lhsrc FILL;
void calcintersectionchar lhsDIMDIM const char rhsDIMDIM
for int r ; r DIM; r
for int c ; c DIM; c
if rhsrc FILL
lhsrc EMPTY;
void calccomplementchar artDIMDIM
for int r ; r DIM; r
for int c ; c DIM; c
artrcartrc FILL EMPTY : FILL;
void rotatechar artDIMDIM double radians
char tempDIMDIM;
inittemp;
const double cosine cosradians;
const double sine sinradians;
static const int cx DIM ;
static const int cy DIM ;
for int r ; r DIM; r
for int c ; c DIM; c
int srcx staticcastcosine c cx sine r cy cx;
int srcy staticcastsine c cx cosine r cy cy;
temprc
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
