Server Side Programming Articles - Page 2282 of 2650

C++ Program to Find the Transitive Closure of a Given Graph G

Arjun Thakur
Updated on 30-Jul-2019 22:30:25

268 Views

If a directed graph is given, determine if a vertex j is reachable from another vertex i for all vertex pairs (i, j) in the given graph. Reachable mean that there is a path from vertex i to j. This reach-ability matrix is called transitive closure of a graph. Warshall algorithm is commonly used to find the Transitive Closure of a Given Graph G. Here is a C++ program to implement this algorithm.AlgorithmBegin    1. Take maximum number of nodes as input.    2. For Label the nodes as a, b, c…..    3. To check if there any edge ... Read More

How to get the IP Address of local computer using C/C++?

Akansha Kumari
Updated on 11-Jun-2025 18:01:43

9K+ Views

In this article, we will see how to get the Host name and IP address of the local system in an easier way using C and C++ program.  Getting IP Address of Local Computer For this, some standard networking functions are available in socket programming with header files like on Windows and , , on Linux. In this article we will mainly discuss three commonly used functions: Sr.No ... Read More

C/C++ Struct vs Class

Smita Kapse
Updated on 30-Jul-2019 22:30:25

430 Views

In C++ the structure and class are basically same. But there are some minor differences. These differences are like below.The class members are private by default, but members of structures are public. Let us see these two codes to see the differences.Example#include using namespace std; class my_class {    int x = 10; }; int main() {    my_class my_ob;    cout

Difference between void main and int main in C/C++

Akansha Kumari
Updated on 09-Jun-2025 15:28:49

38K+ Views

The main() function in C and C++ is anentry point of a program from where the execution begins. And there are two common ways available to define the main function; int main() and void main(). In this following article we will learn the differences between these two in detail. The main() function is the same like other functions, which takes arguments and returns some value. A point to keep in mind is that the execution of a program always begins from the main() function. When a program runs, the operating system calls the main() and the value returned from it ... Read More

How to generate different random numbers in a loop in C++?

Anvi Jain
Updated on 30-Jul-2019 22:30:25

4K+ Views

Let us see how to generate different random numbers using C++. Here we are generating random numbers in range 0 to some value. (In this program the max value is 100).To perform this operation we are using the srand() function. This is in the C++ library. The function void srand(unsigned int seed) seeds the random number generator used by the function rand.The declaration of srand() is like below −void srand(unsigned int seed)It takes a parameter called seed. This is an integer value to be used as seed by the pseudo-random number generator algorithm. This function returns nothing.To get the number ... Read More

Returning multiple values from a C++ function

Aman Kumar
Updated on 12-Jun-2025 17:51:03

10K+ Views

In C++, we cannot return multiple values from a function directly. But, by using some methods (i.e., techniques), we can return multiple values from a function. How to Return Multiple Values from a Function? A function can return only one value using the return statement. We can return multiple values (more than one value) from a function by using the "call by address" and "call by reference" approach in the invoker function. Return Multiple Values from a Function Using Call by Address In C++, the call is an address, also known as a call by pointer. It passes ... Read More

Checking if a double (or float) is NaN in C++

Aman Kumar
Updated on 18-Jun-2025 18:47:53

14K+ Views

In this article we will check whether a double or floating point number is NaN (Not a Number) in C++. Checking if a Double or Floating Point Number is NaN To check, we can utilise the isnan() method. The isnan() function is available in the cmath library. This function was introduced in C++ version 11. So From C++11 next, we can use this function. The isnan() function is used to determine whether a double or floating point number is not-a-number (NaN) value. Return true if num is NaN, false otherwise. C++ Program to Check Double or Float Number is NaN ... Read More

How do you get assembler output from C/C++ source in gcc?

Aman Kumar
Updated on 30-Jun-2025 13:22:39

3K+ Views

In this article, we will see how to generate the assembler output from C or C++ code using GCC. What is GCC The GCC, which stands for GNU Compiler Collection, is a set of compilers and development tools available for various operating systems such as Linux, Windows, and a wide variety of other OSs (operating systems). It supports mostly C and C++, but also Objective-C, Ada, Go, Fortran, and D. The Free Software Foundation (FSF) created GCC and distributed it as totally free (as in libre) software. How to Get Assembler Output The GCC has a great feature that allows ... Read More

Order of evaluation in C++ function parameters

Aman Kumar
Updated on 04-Aug-2025 16:02:00

268 Views

In C++, when we pass multiple arguments to a function, a common question arises, in what order are these arguments evaluated? Is it from left to right, right to left, or does it depend on the compiler? In this article, we will learn how function parameter evaluation works in C++, why the order of evaluation is important, and how it can vary across different compilers. Is the Order of Evaluation Defined in C++? The C++ standard does not guarantee a fixed order of evaluation for function arguments. This means compilers are free to evaluate arguments from left to ... Read More

ipaddress - IPv4/IPv6 manipulation library in Python

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

946 Views

Internet Protocol is currently in the process of moving from version 4 to version 6. This is necessitated because version 4 doesn’t provide enough addresses to handle the increasing number of devices with direct connections to the internet.An IPv4 address is composed of 32 bits, represented into four eight bit groups called as "octets". This is a "dotted decimal" format where each eight-bit octet can have a decimal value 0 to 255.For example: 192.168.1.1IPv4 address with CIDR notation: 192.168.1.1/24 where 24 means first three octets identify the network and last octet identifies node.An IPv6 address is 128 bits long. It ... Read More

Advertisements