acos() function in C++ STL

Chandu yadav
Updated on 24-Jun-2020 11:43:36
The acos() function returns the inverse cosine of an angle given in radians. It is an inbuilt function in C++ STL.The syntax of the acos() function is given as follows.acos(var)As can be seen from the syntax, the function acos() accepts a parameter var of data type float, double or long double. The value of this parameter should be between -1 and 1. It returns the inverse cosine of var in the range of -pi to pi.A program that demonstrates acos() in C++ is given as follows.Example Live Demo#include #include using namespace std; int main() {    double d = ... Read More

atan2() function in C++ STL

Arjun Thakur
Updated on 24-Jun-2020 11:42:59
The atan2() function returns the tangent inverse of the coordinate in terms of y and x. Here y and x are the values of the y and x coordinates respectively. It is an inbuilt function in C++ STL.The syntax of the atan2() function is given as follows.atan2(dataType var1, dataType var2)As can be seen from the syntax, the function atan2() accepts two parameters var1 and var2 of data type float, double or long double that are y and x point respectively.The value returned by atan2() is in the range of -pi to pi and is the angle between the (x, y) ... Read More

How to specify that the audio/video will start over again, every time it is finished in HTML?

V Jyothi
Updated on 24-Jun-2020 11:42:44
Use the loop attribute to specify that the audio/ video will start over again. You can try to run the following code to implement loop attribute −Example                                        Your browser does not support the video element.          

Nested Classes in C++

Ankith Reddy
Updated on 24-Jun-2020 11:40:43
A nested class is a class that is declared in another class. The nested class is also a member variable of the enclosing class and has the same access rights as the other members. However, the member functions of the enclosing class have no special access to the members of a nested class.A program that demonstrates nested classes in C++ is as follows.Example Live Demo#include using namespace std; class A {    public:    class B {       private:       int num;       public:       void getdata(int n) {          num = n;       }       void putdata() {          cout

Constructors in C++

Arjun Thakur
Updated on 24-Jun-2020 11:39:55
Constructors are functions of a class that are executed when new objects of the class are created. The constructors have the same name as the class and no return type, not even void. They are primarily useful for providing initial values for variables of the class.The two main types of constructors are default constructors and parameterized constructors. Details about these are given as follows.Default ConstructorsDefault constructors do not take any parameters. If a default constructor is not provided by the programmer explicitly, then the compiler provides a implicit default constructor. In that case, the default values of the variables are ... Read More

Center pagination on a web page with CSS

Daniol Thomas
Updated on 24-Jun-2020 11:39:33
You can try to run the following code to center pagination on a web page:ExampleLive Demo                    .demo {             display: inline-block;          }          .demo1 {             text-align: center;          }          .demo a {             color: red;             padding: 5px 12px;             text-decoration: none;             transition: background-color 2s;             border: 1px solid orange;             font-size: 18px;          }          .demo a.active {             background-color: orange;             color: white;             border-radius: 5px;          }          .demo a:hover:not(.active) {             background-color: yellow;          }          .demo a:first-child {             border-top-left-radius: 10px;             border-bottom-left-radius: 10px;          }          .demo a:last-child {             border-top-right-radius: 10px;             border-bottom-right-radius: 10px;          }                     Our Quizzes                                                

How to specify the number of columns an element should be divided into with CSS

Chandu yadav
Updated on 24-Jun-2020 11:38:36
To specify the number of columns an element should be divided into, use the column-count property.You can try to run the following code to implement the column-count property with 4 columnsExampleLive Demo                    .demo {             column-count: 4;          }                              This is demo text. This is demo text. This is demo text.          This is demo text. This is demo text. This is ... Read More

Copy Constructor in C++

Chandu yadav
Updated on 24-Jun-2020 11:38:16
The copy constructor is a type of constructor. It creates an object and initializes it with an object of the same class. If the copy constructor is not defined in the class, the compiler itself defines one. A copy constructor is a must for a class that has pointer variables or dynamic memory allocations.A program that demonstrates a copy constructor is as follows.Example Live Demo#include using namespace std; class Demo {    private:    int num1, num2;    public:    Demo(int n1, int n2) {       num1 = n1;       num2 = n2;    }    Demo(const ... Read More

Destructors in C++

Arjun Thakur
Updated on 24-Jun-2020 11:36:56
Destructors in C++ are members functions in a class that delete an object. They are called when the class object goes out of scope such as when the function ends, the program ends, a delete variable is called etc.Destructors are different from normal member functions as they don’t take any argument and don’t return anything. Also, destructors have the same name as their class and their name is preceded by a tilde(~).A program that demonstrates destructors in C++ is given as follows.Example Live Demo#include using namespace std; class Demo {    private:    int num1, num2;    public:    Demo(int n1, ... Read More

Default Constructors in C++

Ankith Reddy
Updated on 24-Jun-2020 11:35:35
Constructors are functions of a class that are executed when new objects of the class are created. The constructors have the same name as the class and no return type, not even void. They are primarily useful for providing initial values for variables of the class. The two main types of constructors are default constructors and parameterized constructors.Default constructors do not take any parameters. If a default constructor is not provided by the programmer explicitly, then the compiler provides a implicit default constructor. In that case, the default values of the variables are 0.A program that demonstrates default constructors is ... Read More
Advertisements