C++ Programming Tutorials

C++ Programming Tutorials And Articles
  Title / Author Reverse Sort Order Replies
Introduction In C++ programs there is use of common data structures like stacks, queues and lists. A program may require a queue of customers and a queue of messages. One could easily implement a queue of customers, then take the existing code and implement a queue of messages. The program...
It's a truly neutral question: given that there are many languages to choose from, why do you choose to program in C++? 1. Compared to many of the other OO languages (i.e. Java, C# etc.), C++ has better support for the functional programming style. 2. Good support for generic programming. ...
Introduction Object-oriented programming (OOP) is a programming language model organized around "objects" rather than "actions" and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data. The...
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....
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...
Memory pools allow dynamic memory allocation comparable to malloc or the Operator new in C++. As those implementations suffer from fragmentation because of variable block sizes, it can be impossible to use them in a real time system due to performance. A more efficient solution is preallocating a...
Casts are used to convert the type of an object, expression, function argument, or return value to that of another type. Some conversions are performed automatically by the compiler without intervention by the programmer. These conversions are called implicit conversions. The standard C++...
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...
Generics are parameterized types supported by the common language runtime. A parameterized type is a type that is defined with an unknown type parameter that is specified when the generic is used. C++ supports templates and both templates and generics support parameterized types to create typed...
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. ...
Many of us might have wondered at sometime or the other about how to pass a variable number of arguments to C++ functions : something like a printf function. I don't know how many are aware of this, so I decided to post an article on this topic. Background When a function is declared, the...
Introduction Many times you may have wondered how to return several values from a C++ function. I know it's easy for most of you when you know "how many" values your func is going to return. I have seen many people use std::pair to return two values from a func. But what about the case when you...
A Simple program for implementing Linked Stack #include<stdio.h> #include<stdlib.h> #include<conio.h> struct node { int data;
Data Structures operations using STL(Standard Template Library) #include<iostream> #include<vector> #include<algorithm>// Included for Algorithmic functions such as sort,max_element,binary_search etc #include<stdlib.h> using namespace std; void main() { int i,number,array,choice,srch;...
Virtual Destructor Virtual Destructor is used to release the derived class objects in a proper order.... Consider an Example: #include<iostream.h> class Base
You can add words to be highlighted in the IDE of Visual Studio 6, 2003 and 2005. Steps (From MSDN) In the same directory as msdev.exe (for Visual Studio .Net search for ...\Microsoft Visual Studio.NET\Common7\IDE\devenv.exe), use the Text editor or Windows Notepad to create a text-only...
Introduction A C++ class with lots and lots of comment on each line for you to understand what each line does and how the program flow works. The Code #include <iostream> // Included for cout
Sort the content of a linked list. Note: I had a major bug pointed out by RiOrius and is rectified now. Thanks for letting me know about it. #include <iostream> using namespace std; #define NULL 0
Background I happen to manage many sites this days and so at times I need to upload lots of things to my servers and when uploading from windows PC to Linux servers the biggest problem that comes up is the case sensitive issues and so I tried googling it but what I found are some cool utilities...
The misconception that C++ is an advance C still prevails among developers and so let me try to clarify that C++ only inherits some syntax from C and nothing more than that. Before I get into the details about the difference between C and C++ programming let me clarify a myth, which is, you need to...