Skip to main content

Posts

C++ Arrays, functions, pointers and references.

In the previous section, I have discussed about  Built-in Data Types in depth. Now, let's taste the flavors of Variables and literals, with a in depth introduction. Variables A Variable provide us with named memory storage, i.e. a storage in our so called RAM with a particular name (usually we give the name), We can write, modify and use this storage with the help of associated name (variable). Each variable in C++ is associated with some specific data type, like Built-in data types that we previously discussed.  There are mainly two values that are associated with any variable. RValues. LValues. Let's see what all these means. RValues - We know that a variable has some data associated with it, and we can read, write this data, this data that we read and write is termed as RValue. You can also think of RValues as Read Values or as a simple trick from me to you, you can think of as the right side values of assignment opeartor(=) . LValues - We Also know that these variables a

C++ Built-in Data types.

Before diving into definition of various Data Types, let's first discuss something about memory. Below is the block diagram of memory(ram) where all the data is temporarily stored before execution. Memory. The lower area of this diagram is referred as Low Memory address and upper area of this diagram is referred as High Memory address. Now let's briefly discuss each of the segments, one by one. Code Segment - The segment of memory where the text or code or your file is stored temporarily is referred as code segment. For example the main function, the function that we defined etc. Data Segment  - Data segment is of two types  Initialized data segment or simply data segment - The variables that are declared and initialized in our program are stored here. Uninitialized data segment .- The variables that are just declared or have value zero and not in use are stored here. Heap - Heap is a storage where generally dynamic memory allocation takes place with the help of pointers. If

Creating and executing c++ program.

In this slide we will discuss the following things. Creating an C++ file. Writing a Program and learning every aspect of its execution like. compilation, assembling and linking of library functions. Creating C++ File You should skip to " Your First Code ", if you know how to do this .😉 C++ program is nothing but a file with extension ".cpp". Creating a C++ file is not difficult. You can create it in anyway you like, I gave a simple way for creating. (Note - If you have not installed c++ compiler in your computer. Then, to run the c++ files, you must install  the compiler first or you can use some online c++ compiler like onlinegdb ) Your First Code Now, start typing the following code in your ".cpp" that you created. (This is also called as source code and you can consider it as the basic template for your c++ program, but I will progressively introduce more things that you can add to your c++ program). 1 2 3 4 5 6 #include<iostream> int main ()

Algorithms, Pseduocodes and FlowCharts.

Some Basic Knowledge. C++ is a general purpose programming language, created by Bjarne Stroustrup and was firstly released in  1985. It is an extension to C language, Reason for that is if you are familiar with C language than you must be familiar with the fact that there are no classes, templates etc. present in C language. Due to which when classes are added to C language it is named as "C with Classes", but C++ is considered as default name now.  Extra thing to remember - In "C++" the symbol "++" after C is post increment symbol and therefore, "C++" means that In C additional features are added. Now, let's define, what are algorithms? Algorithms are nothing but set of rules that must be followed to accomplish some task. (Now, What that mean?😕) let's take an example of swapping two numbers, i.e. if a = 10 and b = 20 after swapping a = 20 and b = 10. How will you write the procedure for this?  (There are many such algorithms). Accordin

Number Systems(Octal and Hexadecimal).

Let's start from the point where we've left in the previous slide. I previously said that Octal and Hexadecimal are useful to represent very large number, when binary number system fails to represent those in an efficient way. First we will discuss about Octal Number System. Octal Number System I have already given you the advantage of octal number system. Now let's look, what the octal number system actually is?. Octal means 8 (just like binary means 2 and decimal means 10). It means that in octal number system we have 8 distinct value i.e. 0,1,2,3,4,5,6,7.  Ok, now we know advantage of octal system and what distinct values it contains. Now, let's see how we utilize that advantage which it has over the binary number system. Octal and Binary Comparison. Converting Binary to Octal number : You can clearly see that where we require 3 bits in binary form we can represent that number easily in 1 bit of octal form. Now you might be thinking that if the number of bits is grea

Number Systems (Binary and Decimal Number Systems).

We are surrounded with Numbers.  For example a human being has 2 ears, 2 legs(generally) and one nose. These all are nothing but numbers. Now, one might ask why do we need to study numbers for c++ programming. Let me answer this one first. In the previous blog I discussed that every computer works on machine language i.e. 0s and 1s, everyone know 0 and 1 are numbers. Ok, done, But what the word "Systems" doing here? What is meant by number systems. Let's see. We all have studied about the numbers from 0 to 9 i.e. 0,1,2,3,4,5,6,7,9 and we very well know that every other number can be derived from these number except infinity(no one knows what's that). for example one thousand twenty two is 1022.  This number system that we have studied is called Decimal Number System.  Why, Decimal? Because this number system contains 10 different symbols.  (In Greek Deca or Deka means 10 and this words is derived from Deca/Deka). Ok, Now we know what is decimal number system and why

Introduction to Computer Science.

 Before directly jumping deeply in c++, let's first start by creating the roots of computer science. In this post we will answer the following question. What is Computer and How it works? What is Program and Operating system? Low Level vs High Level Language? Compiler v/s Interpreter? By Knowing All these basic concepts You will be able to understand the upcoming more complex concepts easily. Let's start answering the above questions. What is Computer and How it works? What is computer? If I answer briefly,  what is computer?  then it is just a calculator used for doing simple calculations. If I have to answer where is computer used?, then I could probably say everywhere. We are surrounded by computer, for example mobile, smartwatches, and personal computer (obviously).  The below image is the first mechanical computer that we used for calculation.                                        Abacus How computer works? The computer's internal functionality is a whole separate bra