Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

kursovoy / borland / MENU

.CPP
Скачиваний:
14
Добавлен:
03.03.2016
Размер:
1.77 Кб
Скачать
#include <stdio.h>
#include <stdlib.h>
#include <graphics.h>
#include <conio.h>
#include <math.h>
#include <windows.h>
#include <dos.h>
#include <string.h>
#include "kursach1.cpp"
#include "kursach2.cpp"
#include "kursach3.cpp"
#include "info.cpp"
void main()
{
int gdriver = DETECT, gmode, errorcode;
 initgraph(&gdriver, &gmode, "c:\\borlandc\\bgi");
 errorcode = graphresult();
 if (errorcode != grOk)
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1);
   }
int i,x1[4],x2[4],y1[4],y2[4];
int cc,col1=4,col2=15;
int kk,it=0,ent=0;
x1[0]=600;
x2[0]=20;
y1[0]=10;
y2[0]=40;
for(i=1;i<4;i++)
{
x1[i]=x1[0];
x2[i]=x2[0];
y1[i]=y1[i-1]+40;
y2[i]=y2[i-1]+40;
}
key:
if(ent==1)
{
if(it==0)
	{
	 cleardevice();
	 clrscr();
	 setfillstyle(1,15);
	 floodfill(0,0,15);
	 info();
	}
if(it==1)
	{
	 cleardevice();
	 clrscr();
	 zad1();
	 getch();
	}
if(it==2)
{
cleardevice();
clrscr();
	 zad2();
	 getch();
}
if(it==3)
{
cleardevice();
clrscr();
	 game();
	 getch();
}
}
cleardevice();
setfillstyle(1,0);
floodfill(0,0,0);
for(i=0;i<4;i++)
	{
	if(i==it)
	cc=col2;
	else
	cc=col1;
	setcolor(cc);
	rectangle(x1[i],y1[i],x2[i],y2[i]);
	setfillstyle(1,cc);
	floodfill(x1[i]-10,y2[i]-10,cc);
	}
	setcolor(BLACK);
	outtextxy(x2[0]+20,y2[0]-15,"Info");
	outtextxy(x2[1]+20,y2[1]-15,"zadanie 1");
	outtextxy(x2[2]+20,y2[2]-15,"zadanie 2");
	outtextxy(x2[3]+20,y2[3]-15,"zadanie 3");
kk=getch();
if(kk==0)
kk=getch();
ent=0;
switch(kk)
{
case 72: if(it==0){it=3;} else it--;  goto key; break;
case 80: if(it==3){it=0;} else it++; goto key;  break;
case 13: ent=1;  goto key; break;
case 51: break;
}
}
Соседние файлы в папке borland