Programming Articles - Page 1943 of 3366

Program to find remainder when large number is divided by 11 in C++

Ayush Gupta
Updated on 17-Sep-2020 05:07:47

492 Views

In this problem, we are given a string num which is a large number. Our task is to create a program to find remainder when large number is divided by 11 in C++.Problem Description − We need to find the remainder when the number defined by the string is divided by 11.Let’s take an example to understand the problemInputnum = “43212981843718452”Output7Solution ApproachTo find the remainder, we obviously need to divide the number. But dividing huge number is a complex process so to ease up the process, we will divide digit by digit. And store the remainder that follows. This process ... Read More

Program to find Prime Numbers Between given Interval in C++

Ayush Gupta
Updated on 19-May-2020 11:43:27

328 Views

In this tutorial, we will be discussing a program to find prime numbers between given intervals.For this we would be provided with two integers. Our task is to find the prime numbers in that particular range.Example Live Demo#include using namespace std; int main() {    int a, b, i, j, flag;    //getting lower range    a = 3;    //getting upper range    b = 12;    cout

Program to find Perimeter / Circumference of Square and Rectangle in C++

Ayush Gupta
Updated on 01-Oct-2020 11:22:01

522 Views

In this problem, we are given the side of a square (A) and the length and breadth of a rectangle (L and B). Our task is to create a Program to find Perimeter / Circumference of Square and Rectangle in C++.Problem Description:To find the circumference of a square, we need the side of the square (a). For that, we will use the formula for the perimeter of the square which is 4a.To find the circumference of a rectangle, we need the Length (L) and breadth (B) of the rectangle. For that, we will use the formula for the perimeter of ... Read More

Program to find parity in C++

Ayush Gupta
Updated on 19-May-2020 11:38:59

421 Views

In this tutorial, we will be discussing a program to find parity.For this we will be provided with a number. Our task is to find its parity i.e count of whether the number of ones are odd or even.Example Live Demo# include # define bool int using namespace std; //finding the parity of given number bool getParity(unsigned int n) {    bool parity = 0;    while (n){       parity = !parity;       n = n & (n - 1);    }    return parity; } int main() {    unsigned int n = 7;    cout

JavaFX example to apply multiple transformations on a node

Maruthi Krishna
Updated on 19-May-2020 12:14:05

268 Views

Transformation refers to a change on the node is in the XY plane. JavaFX supports four basic transforms namely −Scale − Increase or decrease the size.Rotate − Movement of the coordinates of a node around a fixed point with an angle.Translate − Movement of the node in the XY plane.Shear − Displacement of an object in a fixed direction such that its shape is slanted.Every node in JavaFX contains an observable list to hold all the transforms to be applied on a node. You can get this list using the getTransforms() method. You can also add multiple transforms to a node.ExampleThe ... Read More

What is scale transformation in JavaFX?

Maruthi Krishna
Updated on 19-May-2020 07:45:24

458 Views

A scale transform refers to minimizing or maximizing the size of an object. In JavaFX, you can scale a node using an object of the javafx.scene.transform.Translate class. Internally this class multiplies each unit in the coordinate system with the given factor.This class contains six properties (double) type −Three (pivotZ, pivotY, pivotZ) specifying the x, y, z coordinates of the pivot point (about which the scaling occurs). You can set values to these properties using the setPivotX(), setPivotY() and, setPivotZ() methods respectively.Three properties specifying the scale factors along the x, y, and, z axes. You can set values to these properties ... Read More

What is shear transform in JavaFX?

Maruthi Krishna
Updated on 19-May-2020 07:42:30

297 Views

Displacement of an object in a fixed direction such that its shape is slanted is known as shear transform. This is also known as skewing.In JavaFX using the object of the javafx.scene.transform.Shear class, you can skew a node along the required axis. Internally this class rotates the specified axis such that X and Y axes are no longer perpendicular.This class contains four properties −The pivotX property (double) specifying the x coordinates of the shear pivot point. You can set the value to this property using the setPivotX() method.The pivotY property (double) specifying the y coordinates of the shear pivot point. ... Read More

How to rotate a node in JavaFX?

Maruthi Krishna
Updated on 19-May-2020 07:39:12

3K+ Views

If you move an object in the XY plane around a fixed point with an angle it is known as rotation.In JavaFX using the object of the javafx.scene.transform.Rotate class, you can rotate a node. This class internally rotates the coordinate space of the node around a given fixed point, this makes the node to appear rotated.This class contains five properties −The angle property (double) specifying the angle of rotation. You can set the value to this property using the setAngle() method.The axis property (Point3D) specifying the axis of rotation. You can set the value to this property using the setAxis() ... Read More

How to move (translate) a JavaFX node from one position to another?

Maruthi Krishna
Updated on 19-May-2020 07:36:27

2K+ Views

If you move an object on the XY plane from one position to another it is known as translation. You can translate an object along either X-Axis to Y-Axis.In JavaFX using the object of the javafx.scene.transform.Translate class you can translate a node from one position to another. This class contains three properties (double) representing the distance of the desired position from the original position along X, Y, Z plane respectively.Every node in JavaFX contains an observable list to hold all the transforms to be applied on a node. You can get this list using the getTransforms() method.To move a Node ... Read More

How to create an alert in JavaFX?

Maruthi Krishna
Updated on 19-May-2020 07:33:33

2K+ Views

An alert is a dialog which shows pre-built dialog types. You can create an alert by instantiating the javafx.scene.control.Alert class. This class is a subclass of the Dialog class. You can create required type of dialog bypassing the respective parameter at the time of instantiation as −Alert alert = new Alert(Alert.AlertType.CONFIRMATION);ExampleThe following Example demonstrates the creation of an Alert.import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Button; import javafx.scene.control.ButtonBar.ButtonData; import javafx.scene.control.ButtonType; import javafx.scene.control.Dialog; import javafx.scene.layout.HBox; import javafx.stage.Stage; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontPosture; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; public class AlertExample extends Application {    public void ... Read More

Advertisements