We have been playing with strings and doing some basic operations on string for the last two posts. Another such interesting operation with strings is finding one string in another string. There are a number of things to be checked while searching for a string as a substring of second one. We shall be explaining these steps and other details in the proceeding lines.
After a short break, we now continue our series on C++ object oriented programming. Inheritance in C++ has many real time applications. In this article I will be focusing on just one example where inheritance may be used in a C++ program: the database of a workplace organization. This example of inheritance in C++(part 1) is simple and will make clear to you many of the fine details needed to become a good programmer.
We saw how to match the two given strings last time and determine whether they first of them is less than, greater than or equal to the second string. We developed a simple string matching algorithm for that purpose. Similarly we also want to perform a number of other operations on our strings and need to find certain patterns and keys in them. Today we shall develop a simple character finding algorithm in a given string. Let us see which things we need to find out.
Since i started the series, I’ve covered a whole variety of topics ranging from the importance of classes, getters and setters and the various syntax and language complexities you guys need to know before delving into OOP seriously. Now we will get to topics which are a bit harder, and that starts off with inheritance in c++.
Human Beings like to play with string in their daily life. We deal with all sorts of alphabets and words and often try to compare them with one another. To check whether we have two given set of characters equal or not, we make use of string matching algorithms. To match the two given strings, we use then to look for equality in both the strings for the desired results. A simple string matching algorithm is to iterate over each alphabet and match correspondingly. Let us see in detail how we do that.
Our progress in this series of articles on object oriented programming in C++ has been deliberately slow so that readers would have time to grasp the basics of classes and their objects before moving on to their practical usage. Let us pick up the pace a little bit. We will now move to the concept of friendship in c++. From here we can go on to more advanced concepts like inheritance and polymorphism.
After a lengthy break, i’m back with my series on object oriented programming in C++ made easy for beginners. As you may recall, I had started this series as a sort of a basic guide for programmers who were just delving into the basics of OOP in C++. I hope by now all of you understand the basic concepts behind classes and how they are used. All of that prior knowledge will be required, as today I am going to be talking about the concept of operator overloading in classes in C++.
Linear search, as described last time is ineffective for method for finding piece of information, the key from a large list. If you have a database of one hundred thousand people living in Los Angeles, you would surely have a headache if you were to look at each and every element of that database to look for your key. In such situations, Binary Search comes into play. Binary search is a very efficient searching algorithm especially for large amount of data. For binary search to perform, data in the list has to be sorted beforehand.
There are many ways provided by the C++ language to store information. The most basic of them are variables of multiple types i.e. int, float, char etc. But when we require storing the information of a lot of such variables, the language has provided us a facility of arrays. Arrays are the most basic means of storing very large amount of data, and the language allows us the facility to manipulate the data in those arrays in any way we like. But arrays are static and if we need to allocate data on the run time, we use dynamic arrays to store space and allocate memory on the system as per our use. Dynamic arrays are helpful in many scenarios in this language, but sometimes the management of these dynamic arrays can turn to be an issue. There is one more way that C++ language allows to store information through, the use of Linked Lists.
Hello everyone. This is our second post to the common C++ errors and mistakes series. Today, we’ll get to explore some more mistakes that many programmers make, rather unintentionally! These common errors would be in the object oriented paradigm as programmers use it more frequently and get used to it with more effort and hard work.