Posts

For Loop In C++ Programming Language

Image
  For Loop In C++ Programming Language In Programming languages looping statements are used with the help of these looping statements we can repeat some block of code according to our requirement of the program. In C++ programming language we also use these looping statements, these looping statements are also referred as controlled structure . In this blog post we are going to cover for loop statement which is used to execute a block of code repeatedly for a specific number of times. The for loop is " entry controlled " or " pre-tested " loop which means that the condition is checked before the code inside the loop ever runs. We use for loop when we know exactly how many times the loop will going to run. Basic Syntax of for loop in C++ Programming Language for (Initialization; Condition; Increment) { //Code to be executed. } Basic Working Of For Loop in C++ Programming Language As by now we know that loops are used to repeat a block of code. An...

Switch statement in C++ programming language

Image
 Switch statement in C++ programming language In programming languages we have studied about conditional statements in which accross given set of conditions we chose any specific condition and run the block of code as per that condition. There are other techniques that we call control statement or decision making statements . The Switch statement is one of the very important example of such control statement  or deciison making statements . The switch is used to to select and execute one block of code from several possible options. The Switch statement is alternatively used in place of a long if-else-if ladder statement which is an example of conditional statement . It is more cleaner as compared to if-else-if ladder and also it is more efficient for the compiler to process it. Basic Syntax of Switch Statement in C++ programming language Basic Working of Switch Statement in C++ Programming Language In Switch statement we usually take an input from user th...

If Else If ladder statement in C++ Programming Language

Image
 If Else If ladder statement in C++ Programming Language In programming languages we have conditional statements or decision making statements that we can use in order to make decisions among multiple conditions. Today we are going to cover a simple conditional statement which is known as if-else-if ladder statement in C++ programming language.  In C++ programming language the if-esle-if ladder statement is a multi-way decision-making construct, it allows us to test different  conditions in sequence, and executing the block of code associated with the first condition that evaluates to be true. Syntax of if-else-if ladder statement in C++ programming language if(condition1) {     //code to be executed if condition1 is true     } else if(condition2) {     //code to be executed if condition2 is true     }     else if(condition3) {     //code t...

if and if else statement in C++ programming language

Image
  If and if-else statements in the C++ programming language In this blog post we will look at the basic working of if and if-else statement in C++ programming language. These if and if-else statements are also referred as conditinal statements in programming languages. But today we will study them under the context of C++ programming. In C++ programming language we use if and if-else to run a specific peace of code under one condition and another peace of code for some different condition. We also refer them as decision statements . Types of if statements in C++ programming language If we talk about types of if statements there are mainly four types 1) if statement 2) if-else statement 3) if else-if ladder statement 4) nested if statements But in this blog post we will cover the if and if-else statements. Syntax of if statement if(condition) {     //code to be executed here     }   Simple if coding example ...

How To Write Hello World Program In C++ Programming Language

Image
  How To Write a Hello World Program In C++ Programming Language In this post we will look at how a C++ program works. We will try make the example as simple as possible for the beginners so they can easily understand the basics of C++. We will write a simple C++ hello world program in C++ programming language which is considered as the very first program in almost every programming language. A Brief Introduction to the C++ Programming Language C++ is an object oriented programming language and it is an extension to C programming language. C++ is a general purpose programming language and it is also a case-sensitive language. C++ is very powerful programming language it has features of both low level and high level programming languages, and that is why it is called mid level programming language. Hello World program in C++ programming language Above is an example of a simple Hello World program in C++ programming language. Now let us look at the code, and I will take you...

What is File Handling in the C Programming Language

Image
  What is File Handling in the C Programming Language In programming languages, we sometimes encounter situations where we need to store data from a program. Sometimes, it is not enough to just create data during program execution and lose it as the program stops. So, in such situations, we need to store data at some permanent location so that we can access it later on and perform certain operations on it. These operations include creating a new file, opening a file, reading from a file, writing to a file, and deleting the file. From here the concept of file handling comes into the picture. This file handling helps us to store the data permanently and then perform various operations on that stored data and use that data for other important purposes. So in simple words, a file is a location or container in computer storage devices for storing the data. How to work with files in the C programming language In C programming language we can perform different functions o...

How to use Structures in C Programming Language

Image
  How to use Structures in C Programming Language In programming languages like C, C++, C#, etc., sometimes we encounter a situation where we need to store different variables with different datatypes, but these variables are related to one object or instance. In such situations, we use data structures. Today, we are going to discuss a simple technique that will help us store related variables in one place, namely, structures. We will look at how structures are used in the C programming language to help us achieve our target. What is Structure in C Programming Language We can consider structure as a special type of data structure that we can use to store data related to an entity under one umbrella and we can call it structure. We can consider a structure as a user-defined data type and it allows us to store various data types in one place. In structures, each data member used inside the structure body is called a member of a structure. How we can create a Structure...