Samual Sam has Published 2492 Articles

Handling large numbers in C++?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:26

11K+ Views

In C++, we can use large numbers by using the boost library. This C++ boost library is widely used library. This is used for different sections. It has large domain of applications. For example, using boost, we can use large number like 264 in C++.Here we will see some examples ... Read More

What is difference between instantiating a C++ object using new vs. without new?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:26

6K+ Views

In C++, we can instantiate the class object with or without using the new keyword. If the new keyword is not use, then it is like normal object. This will be stored at the stack section. This will be destroyed when the scope ends. But for the case when we ... Read More

How to determine the version of the C++ standard used by the compiler?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:26

4K+ Views

Sometimes we need to know that, what is the current C++ standard. To get this kind of information, we can use the macro called __cplusplus. For different standards, the value of this will be like below.Standard__cplusplus outputC++ pre C++981C++98199711LC++98 + TR1This cannot be checked, this will be marked as C++98C++11201103LC++14201402LC++17201703LExample#include ... Read More

How can I create directory tree using C++ in Linux?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:26

1K+ Views

In this section we will see how to create a directory tree using C++ code in Linux. In Linux terminal we can put some command like “mkdir –p /dir/dir1/dir2” Here –p is used to mark as parent (recursively create inner directories).In C++ code we can use some libraries of Linux ... Read More

How to check if an input is an integer using C/C++?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:26

3K+ Views

Here we will see how to check whether a given input is integer string or a normal string. The integer string will hold all characters that are in range 0 – 9. The solution is very simple, we will simply go through each characters one by one, and check whether ... Read More

Java Program to draw a line on a JFrame in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:26

2K+ Views

The following is an example to draw a line on a JFrame −Examplepackage my; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Line2D; import javax.swing.JFrame; import javax.swing.JPanel; public class SwingDemo extends JFrame {    public SwingDemo() {       JPanel panel = new JPanel();       getContentPane().add(panel);       setSize(550, ... Read More

What is long long in C/C++?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:26

6K+ Views

In some cases we use long long in C or C++. Here we will see what is basically long long is? The long long takes twice as much memory as long. In different systems, the allocated memory space differs. On Linux environment the long takes 64-bit (8-bytes) of space, and ... Read More

Java Program to change JLabel text after creation

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:26

2K+ Views

At first, set a text for JLabel −JLabel label; label = new JLabel("First Label");Now change the above JLabel text using setText() −// changing text label.setText("Updated text");Exampleimport java.awt.Font; import javax.swing.*; public class SwingDemo {    public static void main(String args[]) {       JFrame frame = new JFrame("Label Example");   ... Read More

Variable length arguments for Macros in C

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:26

823 Views

We know that we can use variable length arguments for functions in C. For that we have to use ellipsis (…). Similarly for macros, we can use variable length arguments. Here also we have to include ellipsis, The ‘__VA_ARGS__’ is used to handle variable length arguments. Concatenation operator ‘##’ is ... Read More

How to create JLabel to hold multiline of text using HTML in Java?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:26

734 Views

To hold multiline of text, set HTML under JLabel −JLabel = new JLabel("" + "Line1Line2", JLabel.LEFT);The above will create multiline text in the JLabel −Line1 Line2The following is an example to create JLabel to hold multiline of text −Exampleimport java.awt.Font; import javax.swing.*; public class SwingDemo {    public static void ... Read More

Advertisements