#include<stdio.h>
int main()

{
	char ch;
	int length, width, height, perimeter, area, volume;
	/*This program will calculate the area, perimeter, or volume of a rectangle or rectangular prism*/
	printf("Perimeter, Area, Volume or Quit? Enter P, A, V or Q:\n",ch);
	for(;;)
	{
		ch=getchar();
	if (ch=='P'||ch=='p')
		{
		/*  calculates the perimeter of a rectangle*/
		printf("This will determine the perimeter of a rectangle.\n");
		printf("Enter the rectangle's length in inches:\n");
		scanf("%d",&length);
		fpurge(stdin);
		printf("Enter the rectangle's width in inches:\n");
		scanf("%d",&width);
		perimeter=(2*length)+(2*width);
		printf("The perimeter of the rectangle is %d inches.\n",perimeter);
		}
	else if(ch=='A'||ch=='a')
	{
		/*Calculates the area of a rectangle*/
		printf("This will determine the area of a rectangle.\n");
		printf("Enter the rectangle's length in inches:\n");
		scanf("%d",&length);
		fpurge(stdin);
		printf("Enter the rectangle's width in inches:\n");
		scanf("%d",&width);
		area=length*width;
		printf("The area of the rectangle is %d square inches.\n",area);
	}
	else if(ch=='V'||ch=='v')
	{
		/*Calculates the volume of a rectangle*/
		printf("This will determine the volume of a rectangular prism.\n");
		printf("Enter the rectangular prism's length in inches:\n");
		scanf("%d",&length);
		fpurge(stdin);
		printf("Enter the rectangular prism's width in inches:\n");
		scanf("%d",&width);
		printf("Enter the rectangular prism's height in inches:\n");
		scanf("%d",&height);
		volume=length*width*height;
		printf("The volume of the rectangular prism is %d inches.\n",volume);
	}
		else if (ch=='Q'||ch=='q')
		{/*Quits the program*/
			break;
		}
	else
	{
		printf("Perimeter, Area, Volume, or Quit? Enter P, A, V or Q:\n");
	fpurge(stdin);
	}
	}
}

	
		
/*
 *  PAORV.c
 *  rectangle
 *
 *  Created by Leslie Decker on 5/14/13.
 *  Copyright 2013 __MyCompanyName__. All rights reserved.
 *
 */



