Welcome

Hi! This blog is for beginners of c++ and java .You can check and pick codes for your programming assignments. This will also help you to understand the concepts of these programming languages. Its all about programming.

Switch statement Practice(Square and Cube)

Wednesday, May 18, 2011

#include <iostream.h>
#include <conio.h>
int main ()
{
    clrscr ();
    int a=0;
    char x=' ';
    cout <<"\n Enter THe Number Whose Squre And Cube You Want To Calculate : ";
    cin >> a;
    cout <<"\n\n Now Press s To Start Calculations   =  ";
    cin  >>x;
    switch (x)
    {
        case 's' :
            a=a*a;
            cout <<"Squre Is : " << a <<endl;
        a=a*a;
        cout <<"Cube Of The Number Is = " << a;
    }
    getch();
    return 0;
}