Write a program in C that will randomly choose colors and de
Write a program in C++ that will randomly choose colors, and depending on the options chosen, randomly choose shapes.
Constraints:
Prompt the user for the size of the image. The image itself will be a square. So use this value for the height and width in the svg start tag.
Prompt the user for the number of shapes per row/column. This is the number of columns and rows in the image. For example, if the user entered 4, then there would be 4 rows and 4 columns.
Prompt the user for the background color. There are only 5 background colors allowed: red, green, blue, white, and black.
Ask the user what shapes to generate. Use these options:
These dictate the rules for which shapes are drawn in the images.
When the user selects 1, all the shapes in the image will be squares
When 2, all the shapes will be circles
When 3, all the shapes will be triangles with the point on the \"top\"
When 4, all the shapes will be triangles with the point on the \"bottom\"
When 5, randomly choose among the 4 shapes. Each shape has an even chance of being chosen.
When 6, randomly choose among the 4 shapes and the possibility of a blank spot. Each shape and the blank spot has an even chance of being chosen.
When outputting shapes, All the colors should be randomly generated. For options options 5 and 6, use random values to choose the shapes to output.
Use the input values to generate the file art.svg using ofstream and the required functions defined below.
You cannot include cmath.
initialize the random number generator with
Required Functions
- generate SVG() - background() - rect() -circle() -triangle() -fill()
Sample Run
Solution
#include \"stdafx.h\" #include