
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7197 Articles for C++

5K+ Views
To compile multiple files like file_name.h, or file_name.cpp at once, we can use the files like a list one after another. The syntax will be like this −g++ abc.h xyz.cppTo run the program, we can use this −./a.outExamplefloat area(float r){ return (3.1415*r*r); //area of a circle } float area(float l, float w){ return (l * w); //area of a rectangle }Example#include #include "area.h" using namespace std; main(){ cout

1K+ Views
To add libraries in Visual Studio 2012, there are two different methods. The first one is manual method. The second one is adding libraries from code.Let us see the manual method first.To add some library, we have to follow these five steps −Add the #include statements necessary files with proper declarations. For example −#include “library.h”Add the include directory for the compiler look up;Go to the Configuration Properties/VC++ Directories/Include DirectoriesThen click and edit, and add new entryAdd one library directory for *.lib files:Go to project (on top bar) -> properties -> Configuration Properties -> VC++ Directories -> Library Directories, then click ... Read More

14K+ Views
Here we will see how to compare two floating point data using C++. The floating point comparison is not similar to the integer comparison.To compare two floating point values, we have to consider the precision in to the comparison. For example, if two numbers are 3.1428 and 3.1415, then they are same up to the precision 0.01, but after that, like 0.001 they are not same.To compare using this criteria, we will find the absolute value after subtracting one floating point number from another, then check whether the result is lesser than the precision value or not. By this we ... Read More

337 Views
In this section we will see the nullptr in C++. The nullptr denotes the pointer literals. It is a prvalue of type std::nullptr_t. It has implicit conversion property from nullptr to null pointer value of any pointer type and any pointer to member type. Let us see one program, to understand this concept.Example#include using namespace std; int my_func(int N){ //function with integer type parameter cout

6K+ Views
Here we will see how to convert Little endian value to Big endian or big endian value to little endian in C++. Before going to the actual discussion, we will see what is the big endian and the little endian?In different architectures, the multi-byte data can be stored in two different ways. Sometimes the higher order bytes are stored first, in that case these are known as big endian, and sometimes the lower order bytes are stored first, then it is called little endian.For example, if the number is 0x9876543210, then the big endian will be −The little endian will ... Read More

171 Views
In C++, the inline keyword is used in different places. To create inline variables, or inline namespace, and as well as to create inline methods or functions.C++ inline function is powerful concept that is commonly used with classes. If a function is inline, the compiler places a copy of the code of that function at each point where the function is called at compile time.Any change to an inline function could require all clients of the function to be recompiled because compiler would need to replace all the code once again otherwise it will continue with old functionality.To inline a ... Read More

3K+ Views
The Copy initialization can be done using the concept of copy constructor. As we know that the constructors are used to initialize the objects. We can create our copy constructor to make a copy of some other object, or in other words, initialize current object with the value of another object. On the other hand, the direct initialization can be done using assignment operation.The main difference between these two types of initialization is that the copy initialization creates a separate memory block for the new object. But the direct initialization does not make new memory space. It uses reference variable ... Read More

3K+ Views
The extern “C” keyword is used to make a function name in C++ have the C linkage. In this case the compiler does not mangle the function. Let us see what is the mangling in C++ first, then we can discuss about the extern “C” keyword.In C++ we can use the function overloading feature. Using this feature, we can create functions with same name. The only difference is the type of the arguments, and the number of arguments. The return type is not considered here. Now the question comes how the C++ distinguishes overloaded functions in object code?In the object ... Read More

555 Views
Here we will see some different types of variable declaration based on integer pointers integer constants and the integer constant pointers.To determine them we will use the Clockwise/Spiral Rule. By discussing the terms, we can understand the rules also.The const int *. This is used to tell the compiler that this is a pointer type variable, and this can store address of some constant int. The Clock rule is saying like this −Now the another one is const int * const. This is used to denote that this is one constant pointer variable, which can store the address of another ... Read More

7K+ Views
Here we will see how to compare two floating point data or two double data using C or C++. The floating point / double comparison is not similar to the integer comparison.To compare two floating point or double values, we have to consider the precision in to the comparison. For example, if two numbers are 3.1428 and 3.1415, then they are same up to the precision 0.01, but after that, like 0.001 they are not same.To compare using this criteria, we will find the absolute value after subtracting one floating point number from another, then check whether the result is ... Read More