C++ Articles

Page 594 of 597

C++ Program to Generate Randomized Sequence of Given Range of Numbers

Smita Kapse
Smita Kapse
Updated on 30-Jul-2019 590 Views

At first let us discuss about the rand() function. rand() function is a predefined method of C++. It is declared in header file. rand() is used to generate random number within a range. Here min_n is the minimum range of the random numbers and max_n is the maximum range of the numbers. So rand() will return the random numbers between min_n to (max_n – 1) inclusive of the limit values. Here if we mention lower and upper limits as 1 and 100 respectively, then rand() will return values from 1 to (100 – 1). i.e. from 1 to 99.AlgorithmBegin ...

Read More

C++ Program to Implement Direct Addressing Tables

Anvi Jain
Anvi Jain
Updated on 30-Jul-2019 741 Views

This is a C++ program to implement Direct Addressing Tables. Direct Addressing Tables are used when each element has a key drawn from a universal set S = {0, 1, . . . ,n − 1} where n isn’t too large and each key is unique. It facilitates fast insertion, searching and deletion operations.Functions and pseudocodesBegin    insert():       Take the table variables word and key as argument.       T[ x.key ] = x, where x is a value of key.    delete():       Take the table variables word and key as argument.   ...

Read More

C++ Program to Check if an UnDirected Graph is a Tree or Not Using DFS

George John
George John
Updated on 30-Jul-2019 285 Views

A graph is a tree if it does not contain any cycle. This is a C++ program to check whether an undirected graph is tree or not.AlgorithmBegin function cyclicUtil() :    A) Mark the current node as visited.    B) Recur for all the vertices adjacent to this vertex.    C) If an adjacent is not visited, then recur for that adjacent.    D) If an adjacent is visited and not parent of current vertex, then there is a cycle. End Begin function cyclic():    A) Mark all the vertices as not visited and not part of recursion stack.   ...

Read More

C++ Program to Find Basis and Dimension of a Matrix

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 287 Views

This is a C++ program to find Basis and Dimension of a Matrix.AlgorithmBegin    Function determinant() :    It calculates determinant of the matrix.    /*       Arguments:       n = number of elements.       matrix[10][10] = input matrix.    */    declare the submatrix submatrix[10][10].    //Body of the function:    if (n == 2)       return ((matrix[0][0] * matrix[1][1]) - (matrix[1][0] * matrix[0][1]))    else       Make a for loop c = 0 to n-1          Declare and initialize submati = 0, submatj.     ...

Read More

C++ Program to Generate Random Hexadecimal Bytes

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 2K+ Views

We shall discuss about a C++ program which can generate random Hexadecimal numbers. Here we shall use rand() and itoa() functions to implement the same. Let us discuss on these functions separately and categorically.rand(): rand() function is a predefined method of C++. It is declared in header file. rand() is used to generate random number within a range. Here min_n is the minimum range of the random numbers and max_n is the maximum range of the numbers. So rand() will return the random numbers between min_n to (max_n – 1) inclusive of the limit values. Here if we mention ...

Read More

C++ Program to Remove the Edges in a Given Cyclic Graph such that its Linear Extension can be Found

George John
George John
Updated on 30-Jul-2019 272 Views

In this Program we will basically find a feedback arc set which contains edges which when removed from the graph, graph becomes directed acyclic graph.AlgorithmBegin    function checkCG(int n) :    n: number of vertices.    arr: struct graph variable.    Initialize cnt = 0 and size = (n-1).    For i = 0 to n-1       if (cnt == size)          return 0       if (arr[i].ptr == NULL)          Increase cnt.          for j = 0 to n-1             while (arr[j].ptr ...

Read More

List of C++ IDEs for Linux

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 479 Views

The following are some of C++ IDEs for linux − Eclipse Galileo with CDT Plugin Eclipse is a well-known open source and cross platform IDE. It provides full functional C/C++ IDE with the following features − Code editor with support for syntax highlighting Support for folding and hyperlink navigation Source code refactoring plus code generation Tools for visual debugging such as memory, registers etc. NetBeans IDE NetBeans is free, open source and popular IDE for C/C++. These are some of its features − Support for automatic packaging of compiled application into .tar, .zip and many more archive ...

Read More

C++11 features in Visual Studio 2015

George John
George John
Updated on 30-Jul-2019 426 Views

C++11 is a version of standard C++ language. It was approved by International Organization for Standardization (ISO) on 12 August 2011 then C++14 and C++17. C++11 makes several additions to the core language. Visual C++ implements the vast majority of features in C++11. Some of the following C++11 features in Visual Studio 2015 − nullptr − In the previous nullptr, zero used to be the value and it had a drawback ofimplicit conversion to integral value. The null pointer literal is represented by std::nullptr_t. In this nullptr, no implicit conversion exists. Lambdas − The lambda expression allows to ...

Read More

Which is faster between C++ and C#?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 329 Views

C++ is a middle-level language. It was developed by Bjarne Stroustrup in 1979. It is just an enhancement to C language and an object-oriented language. C# is modern and object-oriented language developed by Anders Hejlsberg. It is a part of the .NET framework. It is designed for Common Language Infrastructure (CLI). It is also a popular language. Difference between C++ and C# Both languages are object-oriented languages. C++ has low level of abstraction while C# has high level of abstraction. In C++, the program can be coded for any platform while in C#, the program is targeted towards windows ...

Read More

The Best C++ Code Formatter/Beautifier?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 808 Views

There are so many C++ code formatter or beautifier tools which beautifies your code or format with proper indentation. The C++ code formatter/ beautifier are listed as follows − C++ Code Formatter/Beautifier Description Astyle This is a source code formatter. It can be used for C++, java and other languages. It’s latest version is 2.03 and it released in April 2013. Clang-Format It is a command line tool along with clang compiler. It is open- source tool and programmed in C++, python. The latest version is 3.3. Universal Indent GUI It ...

Read More
Showing 5931–5940 of 5,962 articles
Advertisements