I need some help creating a circle class. It needs two methods to display the parameters and scaling,and it needs to print to the screen what the position is and the radius. Thanx for any help. I am really struggling with classes for some reason!
I need some help creating a circle class. It needs two methods to display the parameters and scaling,and it needs to print to the screen what the position is and the radius. Thanx for any help. I am really struggling with classes for some reason!
Use the public identifier before you declare your methods and a private scope identifier before you declare the data members of the class. Give it a try.
You will need to create a class with private members such as position (x, y) and radius, and public methods according to your needs. Don't forget about constructor(s) and desctructor.
Hope this helped.
1 rule of the Samurai Code: if you have nothing to say, don't say anything at all!
Think of a class as a special kind of struct. Nothing more. Then just realize that now you can not only have a structure which can hold data, but one that can "hold" functions, create itself, destroy itself, initialize itself(automatically set it's members to zero, sets strings to desired preset values[maybe char *name = "None Yet";]), morph itself according to the arguments it recieves ( even the Types! ), change the meanings of operaters such as "=" applied to it, and of course, who can hide or show it's data to other classes, etc.,etc, etc.
But you have to try doing all this yourself! For a class is only worth what it's programmed to do! You could in fact start small, and write it precicely like a struct. Slowly build on it till it becomes more useful and modualer. Eventually, you will get the hang of it, but don't just ask someone to do it for you. Try it and see for yourself!
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }