Saturday, November 30, 2013

                                                மனம் திறந்து பேசுவோம்


“தற்கொலை வரை போயிருக்கிறேன், ஏன் இப்படி இருக்கிறேன் என்று யோசித்து, என்னாலும் ஜெயிக்க முடியும் என்ற நம்பிக்கையை தந்தது உங்கள் எழுத்து” என்றது அந்த மின்னஞ்சல். என் மனதை அப்படியே படம் பிடித்துள்ளீர்கள் என்று சுருக்கமாக வந்தன பல கடிதங்கள். தமிழ் கூறும் நல்லுலகில் Introversion பற்றி எழுதியது பலர் வலியை சுட்டிக்காட்டியது தெரிந்தது.
நடிகர்களை விட மற்றவர்களை உதாரணம் காட்டியிருக்கலாம் என்று குட்டினார்கள் சிலர். ஆனால் ரஜினி, ரஹ்மான் அளவிற்கு எனக்குத் தெரிந்தவர்கள் பிரபலமில்லையே? சினிமா பாஷையில் (திரும்பவுமா?) சொன்னால் ரஜினி படம் கட்டுரைக்கு நல்ல “ஓபனிங்” தந்தது என்பது தான் உண்மை!
ஒரு கல்லூரி முதல்வர் கைபேசியில் கதறினார்: “முதலிலேயே பசங்க இண்டர்வியூவில் வாயைத் திறக்க மாட்டேங்கறாங்க. நீங்க என்னன்னா இன்ட்ராவர்ட்டை புரிஞ்சுக்கோங்கன்னு எழுதறீங்க. எத்தனை HR களுக்கு நேரம் இருக்கு சார்? பேசுலேன்னா ஒரேடியா ரிஜக்ட் தான். இதுல நம்ம பசங்களுக்கு இங்கிலீஷ் வேற வராது. முதல்ல எல்லாரும் நல்லா பேச கத்துக்கங்கன்னு எழுதுங்க சார்.”
சில இடங்களில் சரியாக பேச முடியாது போவது எல்லாருக்கும் நடக்கிறது. அது ஏன் என்று இப்பொழுது பார்ப்போம்.
உலக மக்களில் அதிகம் பேருக்கு உள்ள மிகப்பெரிய பயம் எது தெரியுமா? மரணம்? இல்லை, அது இரண்டாவது இடம் தான். முதல் இடம் கூட்டத்திற்கு முன் உரையாற்றுவது. இதில் இன்ட்ராவர்ட், எக்ஸ்ட்ராவர்ட் பேதமெல்லாம் இல்லை.
பெரும்பாலும் சொதப்புகிற இடம், படிக்கும் காலத்தில் வைவா எக்ஸாம். பிறகு வேலைக்கான இண்டர்வியூக்கள். பின்னர் ஆரம்ப கால பிசினஸ் பிரசண்டேஷன்கள்.
சொந்த வாழ்க்கையில் காதல் சொல்லும் தருணம், நம்மை யாரோ சோதனை செய்கிறார்கள்; இதில் தவறிழைத்தால் நம் சுய பிம்பம் உடைந்துவிடும் என்கிற போதுதான் பதற்றம் ஏற்படுகிறது. பதற்றம் ஏற்படுத்தும் பல மாற்றங்கள் உடலுக்குள் நிகழ்ந்தாலும், வெளியே அதிகம் தெரிவது நம் பேச்சில் மட்டும் தான்.
வார்த்தைகள் வெளி வராது இருத்தல், திக்குதல், கோர்வையான பேச்சு தவறுவது, தெரிந்த விஷயம் மறந்து போய் திரு திரு என முழித்தல் ஆகியவை எல்லாம் பதற்றத்தின் வெளிப்பாடு தான். அந்த சூழ்நிலையிலிருந்து வெளியே வந்ததும் எல்லா விடைகளும் தெளிவாக நினைவுக்கு வரும். கோர்வையாக சொல்ல வரும். இது எல்லாருக்கும் நடக்கும்.
Performance Anxiety யைக் குறைக்க ஒரே வழி: எது பதற்றம் தருகிறதோ அதைத் தொடர்ந்து செய்வதுதான். இதற்கு மிஞ்சிய உளவியல் உத்தி எதுவும் கிடையாது. நம் கல்வி அமைப்பு ரொம்ப தமாஷானது. பள்ளி காலங்களில் “வாயை மூடு, பேசக்கூடாது, சத்தம் வரக்கூடாது, பேசினால் பனிஷ்மெண்ட்” என்று சொல்லி வளர்த்துவிட்டு, கல்லூரி வந்தவுடன் “எப்படி பேச வைப்பது?” என்று வெளியாட்களை அழைத்து வந்து கருத்தரங்கம் நடத்துகிறார்கள்.
ஒரு கேள்விக்கான விடை எது? புத்தகத்தில் உள்ளதையோ அல்லது ஆசிரியருக்கு தெரிந்ததைதோ சொன்னால் (பெரும்பாலும் இரண்டும் ஒன்று தான், ஹி ஹி!) பையன் தப்பிப்பான். வேறு ஏதாவது சொன்னால் பரிகாசிக்கப்படுவான் அல்லது தண்டிக்கப்படுவான். இதனால் தோல்வி பயத்தை கல்வித் திட்டத்தோடு சேர்ந்து படிக்கிறோம். இந்தத் தாழ்வு மனப்பான்மையை தான் நம் கல்வி முறை இத்தனை காலமாகக் கொண்டாடி வருகிறது. வித்தியாசமாக பதில் சொல்லும் மாணவனை தன் அதிகாரத்திற்கு வந்த அச்சுறுத்தலாக எண்ணுகின்றனர் ஆசிரியர்கள்.
அதே போல இன்னொரு அபத்தம், நன்கு படிக்கும் மாணவனையே வகுப்பு தலைவனாக்குவது. அவன் வேலை யார் பேசினாலும் பெயர் எழுதி டீச்சரிடம் போட்டுக் கொடுப்பது. பாடத்தில் சுமாரான மாணவனோ மாணவியோ வேறு எதற்கும் லாயக்கில்லை என்பதை தொடர்ந்து கல்வி, குடும்பம் மற்றும் சமூக அமைப்புகள் தொடர்ந்து வலியுறுத்துகின்றன.
இவை அனைத்தும் வளர்ந்த காலத்தில் நேர்முகத் தேர்வில் அச்சம் கொள்ள வைக்கின்றன. எதுவும் தெரியவில்லை என்று சொல்லவோ, பதில் கேட்கவோ ஒரு அமெரிக்க மாணவன் தயங்க மாட்டான். இங்கு நம் மக்கள் தெரியவில்லை என்று சொல்ல கூனி குறுகுகிறார்கள்!
இந்தத் தாழ்வு மனப்பான்மையை மேலும் சிக்கல் படுத்துகிறது ஆங்கில பயம். ஜப்பான், கொரியா, சீனா, ரஷியா, ஜெர்மனி, பிரான்ஸ், இத்தாலி, தென் அமெரிக்க நாடுகளில் இல்லாத பாதுகாப்பின்மையும் தாழ்வு மனப்பான்மையும் அவர்களை விட ஆங்கிலம் அதிகம் தெரிந்த நம்மவர்களுக்கு உண்டு.
ஆங்கிலம் அவசியம் தான். கார்பரேட் உலகில் பிழைக்க இன்று அது உலக பொது மொழி ஆனது நிஜம் தான். ஆனால் தாய் மொழியும் சரியாகத் தெரியாமல், பாட அறிவிலும் ஆழமில்லாமல், ஆங்கில பயமும் இருந்தால் அது அடுத்த தலைமுறையைக் கரை சேர்க்காது.
தாய் மொழி அறிவும் தெளிவும் தான் தன்னம்பிக்கையை வளர்க்கும். கல்வி, தொழில் திறன் இருந்தால் எந்த நாட்டிலும் எந்த வேலையையும் செய்யலாம். எந்த மொழியையும் எப்போது வேண்டுமானலும் கற்கலாம். 200 வருடங்களுக்கு முன் பிரிட்டிஷ் அரசை பிரஞ்சு படை வென்றிருந்தால் இன்று பிரஞ்சு படித்துக்கொண்டிருப்போம். சீனர்கள் ஆங்கிலம் தெரியாமலே போடு போடு என்று போட்டுத் தள்ளுகிறார்கள். நாளை நாம் மாண்டரின் கற்றுக்கொள்ளும் நாள் வரலாம்.
இந்தி படிக்காவிட்டால் வேலை கிடைக்காது என்றார்கள் முன்பு. ஆனால் ஐ.டி. புரட்சி சென்னைக்கும் பெங்களூருக்கும் பாலம் போட்டது. இப்போது வடக்கத்தியர்கள் வேலைக்காக இங்கு வருகிறார்கள். அதனால் வேலை நிமித்தமாக எந்த மொழியையும் எப்போது வேண்டுமானாலும் கற்றுக் கொள்ளலாம். சென்னை சென்ட்ரல் போர்டர்கள் சாதாரணமாக ஆறு மொழி பேசுவார்கள். இன்னும் எழுத படிக்கத்தெரியாதவர்கள் அவர்களுள் பலர் உண்டு.
மொழி அறிவை எப்போது வேண்டுமானாலும் சுலபமாக வளர்த்துக் கொள்ளலாம். தன்னம்பிக்கையை வளர்ப்பது கடினம். மாணவர்களை தொடர்ந்து பேச விடுவோம். நேர்காணல் நாள் அத்தனை பதற்றமாக இருக்காது.
இந்தியாவில் ஒவ்வொரு மொழியிலும் மொழி பெயர்ப்பு இலக்கியத்திற்கென்றே தனி பத்திரிகை கொண்டு வர வேண்டும் என்று பேசிக்கொண்டிருந்தபோது, இடை மறித்த நண்பர், “என் பையன் கம்பர், ஷேக்ஸ்பியர் இரண்டும் சேர்ந்த கலவை” என்றார். அவ்வளவு மொழி பெயர்ப்பு புலமையா எனக் கேட்டதற்கு, “சே சே! கம்பரோட ஆங்கில அறிவும் ஷேக்ஸ்பியரின் தமிழ் அறிவும் அவனுக்கு உள்ளது” என்றார். 

Thursday, November 28, 2013


9) Nature of Planning

Primacy of Planning: This deals with the importance of planning for its central role in linking all the other managerial functions.

Pervasiveness (to persuade planning) of Planning: This brings out the ideas that planning is a function and responsibility of every manager, supervisor, and foreman in an organization. 


Plans are means to achieve some ends and without planning, we can not achieve goals and objectives of an organization.

Planning is a pervasive function of management. It is found at all levels and all departments of an organization. 
Top management looks after strategic planning. 

It involves choosing the future course of action from among alternatives.




Monday, November 25, 2013


8) What is the importance of planning in management?

  • Planning is the first and most important function of management. 

  • It is needed at every level of management. In the absence of planning all the business activities of the organization will become meaningless. 

  • The importance of planning has increased all the more in view of the increasing size of organizations and their complexities.

The following facts show the advantages of planning and its importance for a business organization:

(1) Planning Provides Direction:


                                                                                                                 
Under the process of planning the objectives of the organization are defined in simple and clear words. 

In this way, planning has an important role in the attainment of the objectives of the organization.

For example: 

                                                      Suppose a company fixes a sales target under the process of planning. 

Now all the departments, e.g., purchase, personnel, finance, etc., will decide their objectives in view of the sales target.




(2) Planning Reduces Risks:



Planning is always done for future and future is uncertain. 

With the help of planning possible changes in future are activities and planned in the best possible way. 

In this way the risk of future uncertainties can be minimized.

(3) Planning Promotes Innovative Ideas

 

In this way, planning imparts a real power of thinking in the managers. 

It leads to the birth of innovative and creative ideas. 

For example 
                     A company wants to expand its business. 
                      This idea leads to the beginning of the planning activity in the mind of the manager. 

(4) Planning  Decision Making:

Decision making means the process of taking decisions. 

A variety of alternatives are discovered and the best alternative is chosen. 

The planning sets the target for decision making. 

It also lays down the criteria for evaluating courses of action. 

In this way, planning facilitates decision making.




(5) Planning Establishes Standards for Controlling:


By determining the objectives of the organization through planning all the people working in the organization and all the departments are informed about ‘when’, ‘what’ and ‘how’ to do things.

Standards are laid down about their work, time and cost, etc. 


Under controlling, at the time of completing the work, the actual work done. 

For example 
                      A laborer is to do 10 units of work in a day (it is a matter of planning), but actually he completes 8 units. 

                     Thus there is a negative deviation of 2 units. For this, he is held responsible. 


 
















5)  What are the steps involved in Planning Process?


1. Goal setting:



Plans are the means to achieve certain ends or objec­tives.

Therefore, establishment of organizational or overall objectives is the first step in planning. 

Setting objectives is the most crucial part of planning. 

The organizational objectives should be set in key areas of operations.


2. Developing the planning

Before plans are prepared then assumptions and conditions underlying them must be clearly defined these assumptions are called planning premises and they can be identified through accurate forecasting of likely future events.



They are vital to the success of planning as they supply per tenant facts about future. 

They need revision with changes in the situa­tion. 

Contingent plans may be prepared for alternate situations.

3. Reviewing Limitations



In practice, several constraints or limitations affect the ability of an organization to achieve its objectives. 

The key areas of Imitations are finance, human resources, materials, power and machinery. 

The strong and weak points of the enterprise should be correctly assessed.


4.Deciding the planning 



Once the broad goals, planning premises and limitations are laid down, the next step is to decide the period of planning. 

The planning period should be long enough to permit the fulfillment of the commitments involved in a decision.


















5. Formulation of policies
















After the goals are defined and planning premises are identified, management can formulate poli­cies

The res­ponsibility for laying down policies and strategies lies usually with management. 

But, the subordinates should be consulted as they are to implement the policies and strategies.




6. Strategies of Planning






















7. Preparing operating plans:

After the formulation of overall operat­ing plans, the derivative or supporting plans are prepared. 



Several medium range and short-range plans are required to implement policies and strategies.

These plans consist of procedures, programmers, sche­dules, budgets and rules. Such plans are required for the implementation of basic plans.


8. Integration of plans:






Different plans must be properly balanced so that they support one another. 

Review and revision may be necessary before the plan is put into operation. 



Moreover, the various plans must be communicated and explained to those responsible for putting them into practice.

























3) What is the Planners?

                 Planners are the professionals that have the requisite training to take or make decisions that will help or balance the society.













4) Planning processes



 It has three main areas Following are given below:-


  • This first section section sets out some helpful ways to think about the overall planning systems. 





 
 










  • The second chapter is given over to the practical issues of how to apply these general notions. 
 


  • The third and concluding chapter has two parts to it.
     
  • The first of these is concerned with scenario generation.
 
  • The second considers the Forum process, both in respect of what it has achieved and what it may well do next.
 

                                                                  ADET
                                                                 Presents
                                                             BBM & BBA
                                                                      In

                                                             "Management"


1) What is the Planning?
                                         A plan is typically any diagram or list of steps with timing and resources, used to achieve an objective.


Plans can be formal or informal

                                                    Structured and formal plans, used by multiple people, are more likely to occur in projects,careers, economic development, military campaigns, combat, sports, games, or in the conduct of other business.

For example

A  project plan can cost the organization time and money.



2) What is the planning?





It is the process of thinking about and organizing the activities required to achieve a desired goal.



Planning involves the creation and maintenance of a plan.

Planning is one of the executive functions of the brain, encompassing the neurological processes involved in the formulation, evaluation and selection of a sequence of thoughts and actions to achieve a desired goal.









Thursday, November 21, 2013

                           Program that calculate total income of the year


#include <iostream>

using std::cout;
using std::endl;

int main ()
{

    const int salary = 20000;


    float tax = (float) 10 / 100 * salary; 

           
    float monthlyIncome = salary - tax;

    float yearlyBonus = (float) 5 / 100 * salary;


    float yearlyIncome = (monthlyIncome*12) + yearlyBonus;

    cout << "My yearly income is " << yearlyIncome << endl;

    return 0;
}

                                  C++ Constant


Types And Uses


What is Constant ?

  • As similar to variable constant are data storage location. 
  • As the name implies constant's value do not change. 
  • They remain constant throughout the program. 
  • Unlike variable whose value can be changed anywhere in the program.
There are two types of constant in C++. They are as follows :

1) Literal Constant

float PI=3.14;

The value that is directly typed into the program is called literal constant.

Here 3.14 is called literal constant. You cannot assign a value to 3.14.

2) Symbolic Constant

Symbolic Constant are represented by name.

There are two ways to declare a symbolic constant. They are as follows :

1) By using processor directive #define.
This is old way of declaring constant. It has now became obsolete way.

2) By using keyword const.
This way is appropriate way to declare constant.

                                           Area Of Circle Program





#include <iostream>

#define PI 3.14

using std::cout;
using std::cin;
using std::endl;

int main ()
{
    int r;
    cout << "Find the area of circle." << endl;
    cout << "Enter radius : ";
    cin >> r;
    float area = PI * r * r;
    cout << "The area of circle of radius     " << r << " is "
    << area << endl;
    return 0;
}
 

Prefixing And Postfixing In Increment And Decrement Operators


  • Both increment (++) and decrements (--) operator come in two varieties : prefix and postfix. 
  • In prefix the increment or decrement operator is written before the variable's name (++a or --a) 
  • In postfix the increment or decrement operator is written after the variable's name (a++ or a--).
  • Following example given below:-

#include <iostream>
int main ()
{

    using std::cout;
    using std::endl;
    int a = 10;
    a++;
    cout << "The value of a is : " << a << endl;
    ++a;
    cout << "The value of a is : " << a << endl;
    cout << "The value of a is : " << a++ << endl;
    cout << "The value of a is : " << ++a << endl;
    cout << endl;
    int b = 3;
    a = b++;
    cout << "The value of a is : " << a << endl;
    cout << "The value of b is : " << b << endl;
    a = ++b;
    cout << "The value of a is : " << a << endl;
    cout << "The value of b is : " << b << endl;
    return 0;
}

                Increment And Decrements Operator : prefix and postfix



  • In the Increasing a value by 1(n+1) is called incremented
  • Decreasing value by 1(n-1) is called decremented
  • As 1 is the most common value used to add, subtract into variable. 
  • The increment operator(++) increases the variable's value by 1 and the decrements operator(--) decreases the value by 1.

    #include <iostream>
    int main ()
    {
        using std::cout;
        using std::endl;
        int b = 4, c = 7;
        cout << "The value of b is : " << b << endl;
        b = b + 1;
        cout << "The value of b is : " << b << endl;
        b += 1;
        cout << "The value of b is : " << b << endl;
        b++;
        cout << "The value of b is : " << b << endl;
        cout << endl;
        cout << "The value of c is : " << c << endl;
        c = c - 1;
        cout << "The value of c is : " << c << endl;
        c -= 1;
        cout << "The value of c is : " << c << endl;
        c--;
        cout << "The value of c is : " << c << endl;
        return 0;
    }




                           Using the sizeof keyword in c++


    #include <iostream>
    #include <iomanip>

    using namespace std;

    int main ()
    {

        cout << "The size of char is" << setw (9) << ": "
                << sizeof (char) << " byte" << endl;

        cout << "The size of short is" << setw (8) << ": "
                << sizeof (short) << " byte" << endl;

        cout << "The size of int is" << setw (10) << ": "
                << sizeof (int) << " byte" << endl;

        cout << "The size of long is" << setw (9) << ": "
                << sizeof (long) << " byte" << endl;

        cout << "The size of float is" << setw (8) << ": "
                << sizeof (float) << " byte" << endl;

        cout << "The size of double is" << setw (7) << ": "
                << sizeof (double) << " byte" << endl;

        cout << "The size of long double is" << setw (2) << ": "
                << sizeof (long double) << " byte" << endl;

        return 0;
    }

             Logical Operators: AND(&&) OR(||) NOT(!) in c++


    #include <iostream>

    using namespace std;

    int main ()
    {
        char agree;

        cout << "Would you like to meet me (y/n): ";
        cin >> agree;

        if (agree == 'y' || agree == 'Y')
        {
            cout << "Your name: ";
            string name;
            cin >> name;
            cout << "Glad to see you, "+name << endl;
        }

        else if (agree == 'n' || agree == 'N')
            cout << "See you later!" << endl;

        else
            cout << "Please enter 'y' or 'n' for yes or no." << endl;

        return 0;
    }
                 
               Logical Operators: AND(&&) OR(||) NOT(!) in c++

    #include <iostream>
    #include <string>

    using namespace std;

    const string userName = "computergeek";
    const string passWord = "break_codes";

    int main ()
    {
        string name, pass;

        cout << "Username: ";
        cin >> name;

        cout << "Password: ";
        cin >> pass;

        if (name == userName && pass == passWord)
        {
            cout << "You are logged in!" << endl;
        }

        else
            cout << "Incorrect username or password." << endl;

        return 0;
    }


                                           ADET Present


                              Logical Operators: AND(&&) OR(||) NOT(!) in c++



    • You must be understand about first go through relational operators
    • We need to test more than one condition. 
    • To simplify this logical operators were introduced. 
    • You are touched and learned from your eldest school you might have learnt Boolean Algebra (Logic).
    • That as  same formulate it.But it is translate code program in C and C++. 


    The three logical operators ( AND, OR and NOT ) are as follows: 


    1) AND (&&) : Returns true only if both operand are true.
    2) OR (||) : Returns true if one of the operand is true.
    3) NOT (!) : Converts false to true and true to false.

    OperatorOperator's NameExampleResult
    &&AND3>2 && 3>11(true)
    &&AND3>2 && 3<10(false)
    &&AND3<2 && 3<10(false)
    ||OR3>2 || 3>11(true)
    ||OR3>2 || 3<11(true)
    ||OR3<2 || 3<10(false)
    !NOT!(3==2)1(true)
    !NOT!(3==3)0(false)

    Program-I


    #include <iostream>

    using namespace std;

    int main () 
    {
        cout << "3 > 2 && 3 > 1: " << (3 > 2 && 3 > 1) << endl;
        cout << "3 > 2 && 3 < 1: " << (3 > 2 && 3 < 1) << endl;
        cout << "3 < 2 && 3 < 1: " << (3 < 2 && 3 < 1) << endl;
        cout << endl;
        cout << "3 > 2 || 3 > 1: " << (3 > 2 || 3 > 1) << endl;
        cout << "3 > 2 || 3 < 1: " << (3 > 2 || 3 < 1) << endl;
        cout << "3 < 2 || 3 < 1: " << (3 < 2 || 3 < 1) << endl;
        cout << endl;
        cout << "! (3 == 2): " << ( ! (3 == 2) ) << endl;
        cout << "! (3 == 3): " << ( ! (3 == 3) ) << endl;

        return 0;
    }
                                                                  ADET Presents 

                  Maximum and minimum value of numeric data type


    • The C++ presents in numeric data types are short, int, long, float, double and long double. 
    • Each data type has certain limits. 
    • There is minimum and maximum value that it can hold. 
    • If a variable of a given data type is assigned a value that is greater than the maximum limit or smaller than the minimum limit, it results into wrong output. 
    • This mistake does not produce compiler error or run time error. 
    • Hence we should be careful while choosing data type for a variable. 
    • The below is a c++ program which is used to determine the maximum and minimum values that data type can hold.
    #include <iostream>
    #include <limits>

    using std::cout;
    using std::endl;
    using std::numeric_limits;

    int main ()
    {
        cout << "The values for data type short ranges from: "
                << numeric_limits<short>::min () << " to "
                << numeric_limits<short>::max () << endl;

        cout << "The values for the data type int ranges from: "
                << numeric_limits<int>::min () << " to "
                << numeric_limits<int>::max () << endl;

        cout << "The values for the data type long ranges from: "
                << numeric_limits<long>::min () << " to "
                << numeric_limits<long>::max () << endl;

        cout << "The values for the data type float ranges from: "
                << numeric_limits<float>::min () << " to "
                << numeric_limits<float>::max () << endl;

        cout << "The values for the data type double ranges from: "
                << numeric_limits<double>::min () << " to "
                << numeric_limits<double>::max () << endl;

        cout << "The values for the data type long double ranges from: "
                << numeric_limits<long double>::min () << " to "
                << numeric_limits<long double>::max () << endl;

        return 0;
    }

    Tuesday, November 19, 2013

    Hello Programmer
                                  I have attaching a simple of code  Program in C.You can be seeing in given below:-





           
    Dear Learners
                            I have attaching new topics name is ODD and EVEN program-II.you have been seeing in this code program.You can be make and take of abstract then be put at your code program.Let's go your code play program.





    Hello Everyone I have attaching a program in C.That is program name is ODD and EVEN Number.So you can be read and training in this Code Program..



    Monday, November 18, 2013

                            The switch statement in c++


    The program that we create should be readable. 

    To increase the readability of the program we should use tools that is simple to read and understand. 

    When possible use switch statement rather than if else statement, as it can be more readable than if else statement. 

    But switch statement has limitation. 

    It can't replace if else completely but can be helpful at certain situation. 

    It can't do everything thing that if else statement can do. 

    For example, switch statement can take only int or char datatype in c++. 

    The following programs will help you to understand the switch statement.


    Program 1


    #include <iostream>

    using namespace std;

    int main ()
    {
        char permit;

        cout << "Are you sure you want to quit? (y/n) : ";
        cin >> permit;

        switch (permit)
        {
            case 'y' :
                cout << "Hope to see you again!" << endl;
                break;
            case 'n' :
                cout << "Welcome back!" < < endl;
                break;
            default:
                cout << "What? I don't get it!" << endl;
        }

        return 0;
    }



                                                          Program 2

    #include <iostream>
    #include <iomanip>

    using namespace std;

    int main ()
    {
        const int CHEESE_PIZZA = 11;
        const int SPINACH_PIZZA = 13;
        const int CHICKEN_PIZZA = 14;

        cout << " *********** MENU ***********" << endl;
        cout << setw (9) << "ITEM" << setw (20) << "PRICE" << endl;
        cout << " (1) Cheese Pizza" << setw (8) << "$"
                << CHEESE_PIZZA << endl;
        cout << " (2) Spinach Pizza" << setw (7) << "$"
                << SPINACH_PIZZA << endl;
        cout << " (3) Chicken Pizza" << setw (7) << "$"
                << CHICKEN_PIZZA << endl;
        cout << endl;

        cout << "What do you want? ";
        int option;
        cin >> option;

        cout << "How many? ";
        int quantity;
        cin >> quantity;

        int price;

        switch (option)
        {
            case 1:
                price = CHEESE_PIZZA;
                break;
            case 2:
                price = SPINACH_PIZZA;
                break;
            case 3:
                price = CHICKEN_PIZZA;
                break;
            default:
                cout << "Please select valid item from menu. " << endl;
                return 1;
        }

        int amount = price * quantity;
        cout << "Your Bill: $ " << amount << endl;

        return 0;
    }


    Explanation for the above program:


    In the above program we take an integer value from the user which is stored in 'option' variable. 

    We pass this value to switch statement. 


    The switch statement has 3 cases: case 1, case 2 and case 3. The case 1: is similar to if (option == 1). 

    This is the advantage of switch statement over if else statement. 

    You don't need to type the name of variable again and again if you are doing selection operation on same variable. 

    You just put the variable name on switch statement and then just specify the value after 'case'. 

    One more thing to be noted is that it requires 'break' statement at the end of each 'case'. 

    If you remove the break statement then it will jump to the case that follows it. 

    Try it and check by yourself. The 'default' is same as else in if else statement.