// july8ex1.cpp : Defines the entry point for the console application.
// This program first asks the user to input the number of rooms to be 
// processed.  Then, for each room it prompts for the length and the
// width, and computes the area.  At the end, it prints the average
// area.

#include "stdafx.h"

int main(int argc, char* argv[])
	int num_rooms, room, width, length, area, totarea;
	int maxarea, maxroom;


	printf("Please type in the num of rooms: ");
	scanf("%d", &num_rooms);

    maxarea = -9999;
	while (room <= num_rooms) {

        printf("Please type in width and length for room # %d: ", room);

        scanf("%d%d", &width, &length);

		area = width * length;

		printf("\nThe area is %d\n", area);
		totarea = totarea + area;

        if (area > maxarea) {

              maxarea = area;
			  maxroom = room;
		} /* end if area */

	} /* end while room */

    if (num_rooms > 0)
		printf ("\n\nThe average area was %d\n", totarea / num_rooms);
        printf("\nPlease input some numbers next time!!\n");

	printf("The largest area was %d found in room %d\n", maxarea, maxroom);

	return 0;