#include "my_f.h"

int main()
{
	char choice, fn[50];
	char cchoice=1;
	int er=1;
	clrscr();

	while (choice!=13||cchoice!=10)
	{
	 gotoxy(23,15+cchoice);printf("->");
	 gotoxy(26,16);printf("Read from file");
	 gotoxy(26,17);printf("Read from keyboard");
	 gotoxy(26,18);printf("Count of symbols");
	 gotoxy(26,19);printf("Count of words");
	 gotoxy(26,20);printf("Count of sentences");
	 gotoxy(26,21);printf("Unsorted dictionary");
	 gotoxy(26,22);printf("Sorted dictionary");
	 gotoxy(26,23);printf("Outer file");
	 gotoxy(26,24);printf("Inner file with indexes");
	 gotoxy(26,25);printf("Exit");

	 gotoxy(1,1);
	 choice=getch();

	 if (choice==72 && cchoice>1)
	 {
	  gotoxy(23,15+cchoice);
	  printf("  ");
	  cchoice--;
	 }

	 if (choice==80 && cchoice<10)
	 {
	  gotoxy(23,15+cchoice);
	  printf("  ");
	  cchoice++;
	 }

	 if (er!=0) if(choice==13&&cchoice==1) er=fk(fn);
	 if (er!=0) if(choice==13&&cchoice==2) er=kk(fn);
	 if (er!=1) if(choice==13&&cchoice==3) wc(fn);
	 if (er!=1) if(choice==13&&cchoice==7) fwc(fn,0);
	 if (er!=1) if(choice==13&&cchoice==6) fwc(fn,1);
	 if (er!=1) if(choice==13&&cchoice==4) wcnt(fn);
	 if (er!=1) if(choice==13&&cchoice==5) sc(fn);
	 if (er!=1) if(choice==13&&cchoice==8) vf();
	 if (er!=1) if(choice==13&&cchoice==9) fwc(fn,4);
	}

	if (!my_strcmp(fn,TMP_FILE)) unlink(fn);
	return 0;
}