else if and nested if else in c++




This video tutorial explains the else if and nested if and else in c++.
You will learn how to use else if in your program and also how to nest if and else in detail.

source code for this tutorial

#include <iostream>

using namespace std;

int main()
{
    int age = 50;
    if( age <= 20 ){
        cout << "you are young" ;

    }else if ( age <= 40 ){
    cout << "you are in middle age";
    }else{
    cout << "you are an old guy";
    }
    return 0;
}

 
Back To Top