Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that will display a chain formed by drawing overlapping circles. Your program will perform the following steps: a. Prompt the user

Write a C++ program that will display a chain formed by drawing overlapping circles. Your program will perform the following steps:

a. Prompt the user for the radius, and desired rgb color for each circle. Also prompt the user for the number of circles to display. This is performed by the following prompts:

(Enter rgb color: 128 128 128

Enter radius: 20

Enter # of circles: 5)

These prompts should be implemented within the getData function whose prototype is shown below:

void getData(int* r, int* g, int* b, int* radius, int* no_circles)

Valid values for the radius is between 15 and 25 inclusively. Valid values for the number of circles is between 3 and 10 inclusively. This function is called in main as follows:

getData(&r, &g, &b,&radius, &no_circles);

b. Draw the first circle at coordinate (100,100). Each subsequent circle should overlap the previous one by 50%. Circles are numbered from 0,1, starting from the left. Every even numbered circle should be colored to the rgb color entered by the user in getData.

Use the following functions for implementing step b:

//Draws the overlapping circles - all white

//Returns an array containing the object number for each circle

int* drawChain( int radius, int no_circles);

//Colors the even chains to the desired color

//Uses the array containing the object numbers and the desired r/g/b //color

void colorChain(int* objects, int no_circles, int r, int g, int b);

(Functions Required)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analytics Systems Engineering Cybersecurity Project Management

Authors: Christopher Greco

1st Edition

168392648X, 978-1683926481

More Books

Students also viewed these Databases questions