Found 26504 Articles for Server Side Programming

C++ Program to Find the Normal and Trace

Arnab Chakraborty
Updated on 14-Dec-2022 14:50:37

430 Views

2-Dimensional arrays or matrices are very much useful in several applications. Matrices have rows and columns and store numbers inside them. In C++ also we can define 2D matrices using multi-dimensional arrays. In this article, we will see how to calculate the Normal and the Trace of a given matrix using C++. The Normal is the square root of the sum of all elements present in the matrix. And the trace is the sum of elements present in the main diagonal. Let us see the algorithm and C++ code representation. Matrix Normal $\begin{bmatrix} 5 & 1& 8ewline 4 ... Read More

C++ Program to Copy All the Elements of One Array to Another Array

Arnab Chakraborty
Updated on 14-Dec-2022 12:22:48

4K+ Views

The array data structures are used to store homogeneous data in a consecutive memory location to access them in a sequential manner. Arrays are linear data structure so that the basic operations on array can be performed in linear time. In this article we will see how to copy elements from one array to another new array in C++. The new array will be of same type since array elements are homogeneous. After creating another array of same size, we simply copy the elements from first array to the second one by one. Let us see the algorithm and the ... Read More

Haskell program to check whether the input number is a Prime number

Potti Chandra Sekhar sai
Updated on 14-Dec-2022 12:21:57

401 Views

This tutorial discusses writing a program to check whether the input number is a Prime number in the Haskell programming language. Haskell is a Declarative, Strongly Typed, and Functional programming Language. The computations in Haskell are mathematical functions. A prime number is a number having only 1 and the number itself as a factor. Note 1 is neither a prime nor a composite number because it has only one factor. For example, 3 is a prime number because it has only two factors 1 and the number 3 itself. In this tutorial we see, Program to check whether a ... Read More

C++ Program to Sort the Elements of an Array in Ascending Order

Arnab Chakraborty
Updated on 14-Dec-2022 12:21:17

13K+ Views

To solve some problems effectively, it's important to arrange the data items in the correct sequence. One of the most popular arranging problems is the element sorting problem. This article will demonstrate how to arrange array members in C++ in ascending order (according to rising values). To arrange either numerical or non-numerical elements in a specific order, a wide variety of sorting algorithms are available in this field. Only two straightforward sorting techniques will be covered in this article. the selection sort and the bubble sort. Let's examine each one individually using appropriate techniques and C++ implementation code. Sort array ... Read More

C++ Program to Sort the Elements of an Array in Descending Order

Arnab Chakraborty
Updated on 14-Dec-2022 12:18:13

2K+ Views

Arranging data items in a proper form is an essential task while solving some problems in an efficient way. The element sorting problem is one of the most commonly discussed arranging problem. In this article we will see how to arrange the array elements in descending order (decreasing order of their values) in C++. There are many different sorting algorithms present in this domain to sort numeric or nonnumeric elements in a given order. In this article we will see only two simple methods of sorting. The bubble sort and the selection sort. Let us see them one by one ... Read More

Haskell Program to Print the Multiplication Table in Triangular Form

Potti Chandra Sekhar sai
Updated on 14-Dec-2022 12:20:00

294 Views

This tutorial discusses writing a program to print the multiplication table in the triangular form in the Haskell programming language. For example, the multiplication table for the number 10 in the triangular format is 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 6 12 18 24 30 36 7 14 21 28 35 42 49 8 16 24 32 40 48 56 64 9 18 27 36 45 54 63 72 81 10 20 30 40 50 60 70 80 90 100 Algorithm Steps Take input or initialize an integer variable ... Read More

C++ Program to Convert Set of String to Array of String

Arnab Chakraborty
Updated on 14-Dec-2022 12:15:06

2K+ Views

Sets in C++ re containers that contain unique values of a specific type. Arrays or the array container in std C++ is a fixed-size container that contains elements of a specific size. Arrays are like vectors, but the main difference is that arrays are of a fixed size whereas vectors can be dynamic. The array container in C++ is a wrapper for the standard arrays that are available in both C and C++. There is a problem in this conversion though, std arrays do not have support for the common insertion methods that are available with the other containers. So, ... Read More

Haskell Program to Swap Two Numbers

Potti Chandra Sekhar sai
Updated on 14-Dec-2022 12:13:51

1K+ Views

This tutorial discusses writing a program to swap two numbers in the Haskell programming language. Variables are immutable in Haskell i.e once declared their values cannot be changed. So we cannot swap the values of two variables, but we can mimic this by swapping values in a list and tuple. In this tutorial we see, Program to swap two numbers in a binary tuple. Program to swap two numbers in a list. In Haskell, tuples are used to store elements of different data types as a collection. Tuples are identified by parenthesis at the ends. Tuples support only ... Read More

C++ Program to Convert List to Set

Arnab Chakraborty
Updated on 14-Dec-2022 12:11:53

2K+ Views

Lists in C++ are containers the same as vectors, but list implementation is based on doubly linked lists compared to the array implementation of vectors. Lists generally do not contain elements in contiguous locations, the elements of a list are distributed throughout the memory. Lists offer the same constant time operations anywhere in it, that is the main feature of using lists. Sets on the other hand are containers that contain unique values of a certain type and all the elements are sorted in ascending order. The two containers are different, but there are various ways to convert a list ... Read More

Haskell Program to determine the name and version of the operating system

Potti Chandra Sekhar sai
Updated on 14-Dec-2022 12:10:33

231 Views

This tutorial discusses writing a program to find the operating system info in the Haskell programming language. Haskell provides functions to find the system info. These functions can be accessed by importing the Info module from the System package in Haskell. In this tutorial, we see Program to display the name of the Operating System. Program to display the architecture of the processor. Program to display the compiler name. Program to display the compiler version. Syntax To import a module in Haskell the syntax is to follow. import packageName.moduleName To import the Info module from the system ... Read More

Advertisements