Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write a function in mips draw _ spiral ( int x , int y , int size, int colour ) that draws a spiral starting
write a function in mips drawspiralint x int y int size, int colour that draws a spiral starting at x y where the first branch of the spiral has length size Use functions drawhorizontalline and drawverticalline to draw the spiral. Modify your main program to call drawspiral.
Note: Feel free to come up with your own implementation of drawing a spiral. But here is a possible implementation for reference:
drawspiralint x int y int size, int color
whilesize
drawhorizontallinex y size, color;
x x size ;
size;
drawverticallinex y size, color;
y y size ;
size;
x x size ;
drawhorizontallinex y size, color;
size;
y y size ;
drawverticallinex y size, color;
size;
Hint: Print different colours for vertical and horizontal lines while debugging.
Example: For the user input:
Please enter the x coordinate of the position:
this is the input
Please enter the y coordinate of the position:
this is the input
Please enter the size:
this is the input
Please enter the colour wwhite, ggreen, yyellow and rred:
w this is the input
The result of drawspiralw should be:
Example of spiral
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started