Static Keyword in C++

Samual Sam
Updated on 10-Dec-2024 18:20:10

16K+ Views

When a static keyword is used, variables, data members, and functions can not be modified again. It is allocated for the lifetime of the program. Static functions can be called directly by using a class name. Key Points of Static Variables Static variables are variables that are defined using static keywords, which consist of special behavior compared to regular variables. Here we will see its key points. Static variables are initialized only once. The compiler persists the variable till the end of the program. Static variables can be defined inside or ... Read More

Find the Perimeter of a Rectangle in PHP

AYUSH MISHRA
Updated on 10-Dec-2024 14:48:23

7K+ Views

Problem Description Given the length and breadth of a rectangle, we need to implement a PHP program to find the perimeter. A rectangle is a closed two-dimensional figure having 4 sides. The opposite sides are equal and parallel. The angle made by the adjacent side is equal to 90 degrees. The perimeter is the sum of all sides; in other words, the perimeter is two times the sum of length and breadth. In this tutorial, we are going to learn how we can find the perimeter of a given rectangle in PHP using different approaches. Formula of Perimeter of ... Read More

Print Area of Triangle, Square, Circle, Rectangle and Polygon Using Switch Case in C

Bhanu Priya
Updated on 10-Dec-2024 13:25:31

50K+ Views

Problem Write a program to calculate the area of triangle, square, circle, rectangle and polygon by using the switch case. Solution Based on case number, the area of triangle, square, circle, rectangle and polygon is calculated. The logic used to find area of triangle is as follows − Enter sides of a triangle a, b, c s=(float)(a+b+c)/2; area=(float)(sqrt(s*(s-a)*(s-b)*(s-c))); The logic used to find area of square is as follows − Enter the side of square at runtime. area=(float)side*side; The logic used to find ... Read More

Find Roots of a Quadratic Equation in C

Bhanu Priya
Updated on 10-Dec-2024 13:10:44

154K+ Views

Problem Applying the software development method to solve any problem in C Language. Solution Find roots of a quadratic equation, ax2+bx+c. There will be 2 roots for given quadratic equation. Analysis Input − a, b, c values Output − r1, r2 values Procedure $r_{1}=\frac{-b+\sqrt{b^2-4ac}}{2a}$ $r_{2}=\frac{-b-\sqrt{b^2-4ac}}{2a}$ Design (Algorithm) Start Read a, b, c values Compute d = b2 4ac if d > 0 then ... Read More

Sort an Array in Ascending Order in C

Bhanu Priya
Updated on 10-Dec-2024 13:01:40

121K+ Views

Problem Sort the given array in descending or ascending order based on the code that has been written. Solution An array is a group of related data items which share’s a common name. A particular value in an array is identified with the help of its "index number". Declaring array The syntax for declaring an array is as follows − datatype array_name [size]; For example, float marks [50] It declares ‘marks’ to be an array containing 50 float elements. int number[10] It declares the ‘number’ as an array to contain a maximum of 10 integer constants. Each element is identified ... Read More

What is a Watering Hole Attack? Definition, Prevention, and Examples

ARPON KUMAR CHOWDHURY
Updated on 10-Dec-2024 12:16:43

237 Views

Attackers always come up with new ways to breach networks and steal confidential data for all users in the field of cybersecurity. A cybersecurity issue known as the "watering hole attack" occurs when any particular hacker compromises websites that a certain user base is known to visit regularly to target their initial activities.After hacking the website, the attackers infect visitors' computers or phones with malware functions within the system. They rely on the fact that this website is frequently visited by the group they wish to target all the particular information. Attackers can infiltrate people's devices to steal confidential information ... Read More

Find Minimum Sum of Factors of a Number in Java

AmitDiwan
Updated on 09-Dec-2024 21:56:39

461 Views

In mathematics, the factors of a number are the integers that divide the number without leaving a remainder. For a given number, finding the minimum sum of its factors involves identifying a pair of factors whose sum is the smallest among all possible factor pairs. In this article, we will learn to find the minimum sum of factors of a number we will be using the Integer class and Math class in Java − Integer class The Java Integer class serves as a wrapper for the primitive int type, encapsulating a single integer value within an object. For Integer.MAX_VALUE, which provides ... Read More

Check if a String is a Literal or an Object in JavaScript

Mayank Agarwal
Updated on 09-Dec-2024 21:56:22

2K+ Views

In this article, we will be exploring strings and how they can be used as a literal and an object depending on the requirements. In JavaScript, strings can exist in two forms: String Literal: Created using quotes (', ", or `).String Object: Created explicitly using the String constructor, e.g., new String("text"). JavaScript Literals A JavaScript literal can be referred to as representing fixed values in source code. In most languages, values are denoted by Integers, floating-point numbers, strings, boolean, characters, arrays, records, and many more. JavaScript Objects On the other hand, a JavaScript object can be defined as a list of ... Read More

JavaScript Robotics: Controlling Hardware with Johnny-Five and Arduino

Mukul Latiyan
Updated on 09-Dec-2024 21:56:02

472 Views

JavaScript is no longer limited to web development; it has expanded into controlling hardware devices, thanks to frameworks like Johnny-Five. Johnny-Five is a powerful and user-friendly JavaScript robotics library that allows developers to interact with hardware components like LEDs, motors, sensors, and more using microcontrollers such as Arduino. What is Johnny-Five? Johnny-Five is a JavaScript robotics and IoT (Internet of Things) platform that allows you to control hardware devices using JavaScript. It provides a simple and intuitive API that abstracts the complexities of working with electronics, making it easier for developers to prototype and experiment with physical computing projects. Johnny-Five ... Read More

Convert String to Integer in C++

Arnab Chakraborty
Updated on 09-Dec-2024 18:40:33

12K+ Views

C++ is a statically typed language. To write programs we need to define variables of specified types. Sometimes we need to read inputs from the console or files. In such a scenario the string data are read into the program. To convert them into other datatypes needs special operations. In this article, we shall discuss how to convert strings to integers in C++. There are a few different techniques to do so. Let us explore them one by one. String to Integer Using stringstream Class C++ uses streams for different applications. Such streams are filestreams, standard input/output streams, etc. There ... Read More

Advertisements