1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
float l,w;
char choice;
do
{
gotoxy(25,6);
cout<<"PROGRAM #4 - AREA CALCULATOR";
gotoxy(20,10);
cout<<"Find the:";
gotoxy(25,13);
cout<<"a. Area of Reactangle";
gotoxy(25,15);
cout<<"b. Area of Parallelogram";
gotoxy(25,17);
cout<<"c. Area of Triangle";
gotoxy(20,21);
cout<<"Enter choice: ";
cin>>choice;
if(choice=='a'||choice=='A')
{
gotoxy(28,25);
cout<<"Area of Rectangle";
gotoxy(29,28);
cout<<"Enter length: ";
cin>>l;
gotoxy(29,30);
cout<<"Enter width: ";
cin>>w;
gotoxy(31,33);
cout<<"AREA = "<<l*w;
break;
}
else if(choice=='b'||choice=='B')
{
gotoxy(28,25);
cout<<"Area of Parallelogram";
gotoxy(30,28);
cout<<"Enter length: ";
cin>>l;
gotoxy(30,30);
cout<<"Enter width: ";
cin>>w;
gotoxy(33,33);
cout<<"AREA = "<<l*w;
break;
}
else if(choice=='c'||choice=='C')
{
gotoxy(28,25);
cout<<"Area of Triangle";
gotoxy(28,28);
cout<<"Enter height: ";
cin>>l;
gotoxy(28,30);
cout<<"Enter base: ";
cin>>w;
gotoxy(31,33);
cout<<"AREA = "<<(l*w)/2;
break;
}
else
{
gotoxy(25,25);
cout<<"Wrong Entry! That is not in the choices.";
gotoxy(25,27);
cout<<" Press Q to quit and C to continue.";
cin>>choice;
}
}
while(choice=='C'||choice=='c');
if(choice=='q'||choice=='Q')
{return 0;}
|