Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

What needs to be filled into Circle CPP. 1. Make some member variables to describe a circle Maybe make an operator>> and operator /All the

image text in transcribedimage text in transcribed

What needs to be filled into Circle CPP.

1.Make some member variables to describe a circle Maybe make an operator>> and operator

/All the examples below will use the above bob and cindy truct Point \{ float x=0,y=0;// Default position is (0,0) //The "friend" keyword means this function is actually outside the class //(Friend also gives access to private members, but here we don't have any, so it's just an organization thing.) // Point steve = bob - cindy; //steve is {13,16} friend Point operator-(const Point \&lhs, const Point \&rhs) \{ return { lhs. x-rhs. x, lhs y-rhs y}; 3 //Allows us to scale a point towards or away from the origin //Point steve = bob /2; //steve is {1.5,2} friend Point operator/(const Point \&lhs, float scale) \{ return \{lhs.x/scale, lhs.y/scale\}; 3 //How far is this point from the origin? //cout length (bob) distance_to(Point\{float(x), float (y) \}); 3 //You can overload a function so it can take different kinds of parameters... //cout 20.6155 if I did the math right float distance_to(const Point \&rhs) const \{ return hypot (rhs.x-this->x, rhs.y-this->y); \} //This allows you to read a point in from cin, like this - //cin > steve; //Reads two doubles in friend std: :istream\& operator>>(std: :istream\& ins, Point \&rhs) \{ return ins rhs. x rhs.y; \} //This allows you to print a point to cout, like this - //cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions

Question

What are the various types of investments?

Answered: 1 week ago