Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ looping and array In the source file, declare another array of circles with 6 elements. Using a looping statement to put the circles in

C++ looping and array

In the source file, declare another array of circles with 6 elements. Using a looping statement to put the circles in the array a into the newly declared array by following rules:

1. The first circle in the array a goes to the first element of the new array.

2. If a circle in array a is greater than all the circles in the new array, then put this circle after the last circle in the new array, otherwise, insert this circle right in front of the first circle in the new array that is greater than or equal to this circle.

#include #include"Circle.h" using namespace std;

int main() { Circle a[6]={Circle(5),Circle(7),Circle(2),Circle(3),Circle(11),Circle(6)}; Circle t; t=a[0]; for(int i=0;i<6;i++){ if(a[i]>t) t=a[i]; } cout<<"The largest circle is "< //system("pause"); <-- you may need to add this line if you are using VS C++ return 0; }

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 Visualization A Practical Introduction

Authors: Kieran Healy

1st Edition

0691181624, 978-0691181622

More Books

Students also viewed these Databases questions

Question

=+Why do you think your performance changed?

Answered: 1 week ago

Question

answer 1 2 .

Answered: 1 week ago

Question

2. What are the components of IT infrastructure?

Answered: 1 week ago