Here we can learn how to make the Calculator by using switch case.


#include<iostream.h>
#include<conio.h>

void main()
{ clrscr();
  int choice;

   cout<<endl
    <<"1-ADDITION\n"
    <<"2-SUBTRACTIO\n"
    <<"3-MULTIPLICATION\n"
    <<"4-DIVISION\n";

   cout<<"Enter number between(1-9)";
   cin>>choice;

  switch(choice)
  {
    int x,y,add,sub,multi,divide;
    case 1:cout<<"Add\n";
   cout<<"Enter number1\n";
   cin>>x;
   cout<<"Enter number2\n";
   cin>>y;
   add=x+y;
   cout<<"Addition of 2 numbers\t"<<add;
   break;

    case 2: cout<<"Sub\n";
    cout<<"Enter number1\n";
    cin>>x;
    cout<<"Enter number2\n";
    cin>>y;
    sub=x-y;
    cout<<"Subtraction of 2 numbers\t"<<sub;

   break;
    case 3: cout<<"Multiply\n";
    cout<<"Enter number1\n";
    cin>>x;
    cout<<"Enter number2\n";
    cin>>y;
    multi=x*y;
    cout<<"multiply of 2 numbers\t"<<multi;
    break;

    case 4: cout<<"DIVIDE\n";
    cout<<"Enter number1\n";
    cin>>x;
    cout<<"Enter number2\n";
    cin>>y;
    divide=x/y;
    cout<<"divide of 2 numbers"<<divide;
    break;

    default: cout<<"Invalid choice";
  }

       getch();

}


The first release of Turbo C++ was made available during the MS-DOS era on personal computers. Version 1.0, running on MS-DOS, was released in May 1990. An OS/2 version was produced as well.  This compiler supported the AT&T 2.0 release of C++ The latter was able to generate both COM and EXE programs and was shipped with Borland's Turbo Assembler compiler for Intel x86 processors. The initial version of the Turbo C++ compiler was based on a front end developed by TauMetric (TauMetric was later acquired by Sun Microsystems and their front end was incorporated in Sun C++ 4.0, which shipped in 1994).

                 

Download From Here










Turbo C7 is a  Integrated Development Environment and compiler for the C programming language from Borland. It was noted for its integrated development environment, small size, fast compile speed, comprehensive manuals and low price.

Version 1.0  offered the first integrated development environment for C on IBM PCs. Like many Borland products of the time, the software was bought from another company  and branded with the "Turbo" name. It ran in 384 kB of memory. It allowed inline assembly with full access to C symbolic names and structures, supported all memory models, and offered optimizations for speed, size, constant folding, and jump elimination.[3]

Version 1.5 (January 1988) was an incremental improvement over version 1.0. It included more sample programs, improved manuals and bug fixes. It was shipped on five 360 KB diskettes of uncompressed files, and came with sample C programs, including a stripped down spreadsheet called mcalc. This version introduced the <conio.h> header file (which provided fast, PC-specific console I/O routines).


Download From Here


To check the condition odd even in C++ by using if-else

   #include<iostream.h>
   int main()
{
   int a;

   cout << a <<"enter a character";
 
   cin >>a;

   if (a %2== 0)
 
   cout<<a<<"is even";

   else

   cout<<a<<"is odd";

   return 0;
}


The do-while loop displays the current value of digit, increases its value by 1, and then testes to see if the current value of digit exceeds 9.If so the loop terminates, otherwise the loop continues, using the new value of digit. Note that the test  is carried out at the end of each pass through the loop, The net effect is that the loop will be repeated 10 times,resulting in 10 successive line of output.

For example, let us see the calculation for the average of the numbers:


 #include<stdio.h>
 main ()
{

   int n,count = 1;

   float x, average, sum =0;

   /*initialize and read in a value for n*/
   
    printf ("How many numbers ?");

    scanf ("%d" , "%n");

   /* read in the numbers 8 */

do
{
   //*printf (8 x = 8);

   scanf ("%f", &x);

   sum +=x;

   ++count;

   } while (count <= n);


   /* calculate the average and display the answer*/

   average = sum /n

   printf ("\ n the average is &f \n", average);
}


The following program use a cascading if-else construct to determine if the input  character is a vowel, else it print an  appropriate message.


#include<iostream.h>
  int main()
{
 char in_chr;

 cout << "Enter a character in lowercase"<<endl;

cin >> in_chr;

if (in_chr == 'a')
         
                 cout << endl << "vowel a"<<endl;

else if (in_chr =='e')
 
                 cout << endl << "vowel e" << endl;


else if (in_chr == 'i')
 
                 cout << endl << "vowel i" << endl;

else if (in_chr =='o')
 
                  cout << endl << "vowel o" << endl;


else if (in_chr =='u')
  
                  cout << endl << "vowel u" << endl;

else

                  cout << endl << "The character is not a vowel" << endl;
       
                 return 0;
}


The following, for example, program uses a nested if...else construct to check if the input character is uppercase or lowercase.

#include<iostream.h>

#include<conio.h>

int main()

{
  char inp;

  cout << "Please enter a character:";

  cin >> inp;

  if (inp >= 'A')

if (inp <= 'Z')

cout << endl << "uppercase";

else if (inp  >= 'a')

{
if (inp  <=  'z')

cout << endl << "Lowercase";

else

cout << endl << "Input character > z";
        }

else
{
cout << endl << "input character > z but less than a";
}
else
{
cout << endl << "input character less than A";
}
   return 0;

}