Function Overloading Function Overloading is used when we need to handle parameters of different data types. Function Overloading refers to having different function with same name. The functionality of that function is then defined according to the type of parameters given. For example: The above function will not give expected output as we have provided … Continue reading More on Functions
Functions
A group of statement that perform a particular task are known as functions. We have already seen functions, the main() function is an inseparable part of a C++ program. We can define our own functions too. The main() function looks like: The return type of a function is declared first which describe the type of … Continue reading Functions
Data types and Arrays
Data Types Data types specifies the type of data to be stored inside a variable. We have seen some data types before like int: which stores integer, string: which can store names or characters. There are a number of built-in data types in C++. We are going to look at all of them. int : … Continue reading Data types and Arrays
Loops: Part 2
For loop When we know about the terminating condition, but we don't know how many times the loop will execute, we use while loop. But at times we just want our code to run a fixed number of times, no matter what is in the statements, then for loop is used. The syntax of a … Continue reading Loops: Part 2
Loops: Part 1
Loops are used when we want a set of statements to execute until certain condition is satisfied or fulfilled. Loops can also be used when we want to take many inputs from the user. A while loop executes a block of statements as long as the condition remain true. The syntax of a while loop … Continue reading Loops: Part 1
Conditionals
You have learned about getting inputs and displaying outputs but their are certain cases where we want to execute program according to the given input. For example: A vegetable vendor is left only with spinach. Now if any one asks for spinach he will say Yes, if any other vegetable is asked for he will … Continue reading Conditionals
Basics of Input & Output
I hope you are now sure about printing the output using the cout statement. Let us look at the ways to get input. The cin statement is used to get input from the user. We first need to define a variable in which the given input will be stored. For example: int a; cin>>a; //Note … Continue reading Basics of Input & Output
Comments, Variables and some Maths
So far we have seen our first program. Now let's dig into some simple tools and functionalities. Comments Comments are used in a program to explain the working of certain block of code. For example: A single line comment starts with // (double slash). //This is a comment A multi-line comment looks like this: /* … Continue reading Comments, Variables and some Maths
Your First Program
Your First Program As a ritual the very first program of any language is the “Hello, world!” program. It merely prints out Hello, world to the computer screen. A Hello, world program in C++ is: Seems too much, isn’t it? First of all copy paste this code in code::blocks and run it using the build … Continue reading Your First Program
How to setup C++ in your system to start programming.
The first step to get started is setting up the C++ in your system. The following components are used to build C++ programs: 1. Integrated Development System (IDE) : It provides the necessary tools for writing source code . Any text editor can be used as an IDE. 2. Compiler: It compiles source code into … Continue reading How to setup C++ in your system to start programming.
