

#include <stdio.h>
#include <dos.h>
#include <stdlib.h>
#include <conio.h>


static int dungeons;
static int forests;
static int mountains;
static int deserts;
static int plains;
static int hills;
static int coastals;
FILE *fp;

void citycount(void)
{
char st[81];
int x;

	if((fp=fopen("data\\dungeon.dat","r"))!=NULL){
		for(;;){

			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			if(feof(fp)) break;
			dungeons++;
			}
	fclose(fp);
	}
	if((fp=fopen("data\\forest.dta","r"))!=NULL){
		for(;;){

			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			if(feof(fp)) break;
			forests++;
			}
	fclose(fp);
	}
	if((fp=fopen("data\\mountain.dta","r"))!=NULL){
		for(;;){

			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			if(feof(fp)) break;
			mountains++;
			}
	fclose(fp);
	}
	if((fp=fopen("data\\desert.dta","r"))!=NULL){
		for(;;){

			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			if(feof(fp)) break;
			deserts++;
			}
	fclose(fp);
	}
	if((fp=fopen("data\\plains.dta","r"))!=NULL){
		for(;;){

			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			if(feof(fp)) break;
			plains++;
			}
	fclose(fp);
	}
	if((fp=fopen("data\\hills.dta","r"))!=NULL){
		for(;;){

			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			if(feof(fp)) break;
			hills++;
			}
	fclose(fp);
	}
	if((fp=fopen("data\\coastal.dta","r"))!=NULL){
		for(;;){

			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			fgets(st,81,fp);
			if(feof(fp)) break;
			coastals++;
			}
	fclose(fp);
	}


return;
}


void main()
{

citycount();
printf("DUNGEONS=%d\n",dungeons);
printf("FOREST=%d\n",forests);
printf("MOUNTAIN=%d\n",mountains);
printf("DESERT=%d\n",deserts);
printf("PLAIN=%d\n",plains);
printf("HILL=%d\n",hills);
printf("COASTAL=%d\n",coastals);
exit(0);
}

