Posts

Showing posts with the label switch statement in c

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...

Switch statement in c programming language

Image
  Switch statement in c programming language What Is a switch statement? The switch statement is a conditional statement that we use to run different code sections based on some conditions. The switch statement also works like the if else-if else ladder statement. As we know in the else-if ladder statement we implement multiple conditions it is exactly how the switch statement works. In the switch statement, we use the term case: that tells us about any specific condition within the switch expression area switch(expression).   What is the syntax of a switch statement in c programming switch(Some_Epression) { case value1: // insert code here break; case value2: // insert code here break; default: // insert code here } Rules and regulations of switch statement: Always remember that the expressions that are used within the switch statement i.e. switch(expression), this expression must be a single character or an integer value. As discussed earlier  case: ...