#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
vivodstr(char * begin,int x,int y,int n)
{ int i;
gotoxy(x,y);
for (i=0;i<n;i++) putch(*(begin+i));
};
vivodstrok(char *str[],int k,int x1,int y1)
{
int s;
for (s=0;s<k;s++)
{
vivodstr(str[s],x1,y1+s,strlen(str[s]));
}
}
int viborpunktamenu(int xx1,int yy1,int l, int punkt)
{
char ch;
int shetchik=yy1+punkt-1;
gotoxy(xx1-1,shetchik); cout<<'*';
for(;;)
{
switch(ch=getch())
{
case 72: if (punkt>1)
{
gotoxy(xx1-1,shetchik);cout<<' ';
shetchik=shetchik-1;
gotoxy(xx1-1,shetchik);cout<<'*'; punkt=punkt-1;break;
} else
{gotoxy(xx1-1,shetchik);cout<<' ';
shetchik=yy1+l-1;
gotoxy(xx1-1,shetchik);cout<<'*';punkt=l; break;
}
case 80:if (punkt<l)
{
gotoxy(xx1-1,shetchik);cout<<' ';
shetchik=shetchik+1;
gotoxy(xx1-1,shetchik);cout<<'*'; punkt=punkt+1;break;
} else
{gotoxy(xx1-1,shetchik);cout<<' ';
shetchik=yy1;gotoxy(xx1-1,shetchik); cout<<'*';punkt=1; break;
}
case 13:return punkt;
case 27:return l;
}
}
return 0;
}
void main()
{ int s1,t1,punkt;
clrscr();
char* menu[5]={"prosmotr basy",
"Add",
"Delete",
"Find",
"Exit"};
s1=35; t1=10; punkt=1;
for(;;)
{ clrscr();
vivodstrok(menu,5,s1,t1);
switch(punkt=viborpunktamenu(s1,t1,5,punkt))
{
case 1: clrscr(); cout<<"11111"; break;
case 2: clrscr(); cout<<"22222"; break;
case 3: clrscr(); cout<<"33333"; break;
case 4: clrscr(); cout<<"44444"; break;
case 5: goto end;
}
getch();
}
end:
}