MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology

C++ language

Statement
Previous Home Next

if Statement

In if statement condition evaluated if condition is true then statement with in >if block will be executed otherwise control go to else block will executed.

  • Simple if statement
  • if_else statement
Simple if statement:
 if (expression is true)
{
statement1;
}
statement2;
statement3;

 

if_else statement
 if (expression is true)
{
statement1;
}
else
{
statement2;
}
statement3;
if (x == 203035) // if statement
  cout << "x is 203035";
else	//else statement
  cout << "x is not 203035";
Switch Statement:

This is a multi branching Statement which is based on condition. Control is transfer to one of the many statements.

 switch (expression)
{
case 1:
{
statement 1:
.
.
.
statement n;
}
case 2:
{
statement 1:
.
.
.
statement n;
}
.
.
.
.
default:
{
statement 1:
.
.
.
statement n;
}
}
statement;
do while statement:

This is statement where first loop executed then condition evaluated.

 do
{
statement 1;
}
while (condition is true);
statement n ;
while statement:
#include <iostream>
using namespace std;

int main ()
{
  int number;
  cout << "Enter the initial > ";
  cin >> n;

  while (n<10) {
    cout << n << ", ";
    ++n;
  }

  cout << "OUT!\n";
  return 0;

Enter the initial>1
1,2,3,4,5,6,7,8,9,10,OUT!
for Statement:
 for(initial value; test condition; increment/decrement)
{ 
statement 1;
.
.
.
statement n;
}
Previous Home Next