C++ Programming Tutorials

C++ Programming Tutorials And Articles
  Title / Author Replies Reverse Sort Order
Views
The size of a class can be changed simply by playing with the order of its members' declaration: struct A { bool a; int b; bool c; }; /*sizeof (A) == 12*/ On my machine, sizeof (A) equals 12. This result might seem surprising because the total size of A's members is only 6...
2
3,358
We recently saw a tutorial on Vectors in C++. Now its time for better things. So we all know what a set is. It is a group of elements in which there is no duplicate. Consider we need a container with following features: -> add an element, but do not allow duplicates -> remove elements -> get...
2
2,455
1) This Simple program explain one of the use of this pointer in C++. 2) With the help of "this" pointer you can call as many as functions in a sequence. 3) This procedure is called function chaining 4) In this program i have used three different function and through main i have called all...
2
10,296
The Input/Output system in C++, holds information about the result of every I/O operation. The current status is kept in an object from type io_state, which is an enumerated type (just like open_mode) that has the following values: godbit -> No errors. eofbit -> End of file has been reached...
2
11,584
Abstract Introduction Building of the 64-bit version of Loki in Microsoft Visual Studio 2005 Testing of the 64-bit Loki version with the help of Viva64 Incorrectly used constant LONG_MIN Some types of magic numbers - errors or not? Addition of int to a pointer as a potential error Using...
2
2,606
Abstract In this article, Anatoliy Kuznetsov answers the questions and tells us about the open BitMagic C++ Library. Introduction While regularly looking through the Internet-resources related to the sphere of 64-bit programming, I often came across mentioning about BitMagic C++ Library...
2
2,663
Constructors are functions with the same name as the class. They are used to create the instance of a class. They are provided default by the compiler. But still user can have his/her own constructor declared. We can have a constrctor with a single parameter and use this kind of constructor for...
2
26,647
C++ FAQ's I've spent the past few weeks learning C++, and here are a bunch of FAQ's I came up with. Some of these Q n A's are from various sources, but I have edited and revised them using my own words. What is C++? C++ is a computer programming language. Its name is literally...
2
3,107
There are three techniques used to pass variables into a C or C++ functions. Pass by value C/C++ Pass a pointer by value C/C++ Pass by reference C++ only Pass by value The function receives a copy of the variable. This local copy has scope, that is, exists only within the function....
1
2,712
Introduction Memory allocation for objects is a tough issue, sometimes. Dynamically allocated memory has to be treated specially when one object is used to initialize another. In default constructor a bit wise copy is done when one object is assigned to another, leaving no room for separate...
1
3,656
Polymorphism is in short the ability to call different functions by just using one type of function call. It is a lot useful since it can group classes and their functions together. It is the most important part of Object-Oriented Programming. Polymorphism is the core of object-oriented programming...
1
12,543
When exceptions occur, the programmer has to decide a strategy according to which he would handle the exceptions. The strategies could be, displaying the error messages on the screen, or displaying a dialog box in case of a GUI environment, or requesting the user to supply better or simply...
1
10,937
Introduction Variables are seen as memory cells that can be accessed using their identifiers. This way we did not have to care about the physical location of our data within memory, we simply used its identifier whenever we wanted to refer to our variable. The memory of your computer can be...
1
3,149
Three major concepts of C++ are Classes, Polymorphism, Inheritance.Let us discuss them in details. Classes A class is the implementation of an abstract data type. It defines attributes and methods which implement the data structure and operations of the abstract data type, respectively....
1
3,504
Introduction To Binary Trees A binary tree is made of nodes, where each node contains a "left" pointer, a "right" pointer, and a data element. The "root" pointer points to the topmost node in the tree. The left and right pointers recursively point to smaller "subtrees" on either side. A null...
1
34,847
This article is to explain in brief how Visual C++ is handling exceptions Abnormal situations should be handled by throwing and catching exceptions. Such situations are not the same as normal error conditions, such as a function executing correctly, but returning a result code indicating an...
1
8,622
Templates, which are sometimes called parameterized types, are mechanisms for generating functions and classes based on type parameters. By using templates, you can design a single class or function that operates on data of many types, instead of having to create a separate class for each type. ...
1
5,670
I posted a little about this in Sudoku Solving Program Using 'C' so that people could take a look at the solve part of the algorithm if they wanted. I was mid-development and this wasn't the part that was actually to change much except for a removal tweak of a magic number here and there. Since...
1
5,505
Virtual Destructor Virtual Destructor is used to release the derived class objects in a proper order.... Consider an Example: #include<iostream.h> class Base
1
7,915
From the Bubble sort it was obvious that the sorting isn't efficient for larger list, even for a list more than 100 numbers . So there's another lot of sorting algorithms out there and this is just one of them Selection Sort Once you see the way Selection sort works, you'll wonder why one...
1
5,337