View difference between Paste ID: Yc2taAe6 and zZLJ7py1
SHOW: | | - or go back to the newest paste.
1-
#include<stdio.h> 
1+
#include "graphics.h"
2-
#include "graphics.h" 
2+
#include "process.h"
3-
#include "conio.h" 
3+
#include "dos.h"
4-
#include "process.h" 
4+
#include "iostream"
5-
#include "stdlib.h" 
5+
6-
#include "math.h" 
6+
int P, W = 30, H = 200, D = 50, N = 6, X = 400, Y = 50;
7-
#include "dos.h" 
7+
#define M_PI 3.14
8-
#include "iostream" 
8+
void menu();
9
struct Diem
10-
int P,W=30,H=200,D=50,N=6,X=400,Y=50; 
10+
{
11-
void menu(); 
11+
	int x, y;
12-
struct Diem 
12+
};
13-
  {     int x,y; 
13+
void hcos()
14-
  }; 
14+
{
15-
void hcos() 
15+
	int mh = 0, mode = 2;
16-
  { 
16+
	initgraph(&mh, &mode, "");
17-
    int mh=0,mode=2;     
17+
	setbkcolor(BLUE);
18-
	initgraph(&mh,&mode,"");     
18+
	settextstyle(5, 0, 10);
19-
	setbkcolor(BLUE); 
19+
	outtextxy(220, 30, " Do thi ham so y = cos(x)");
20-
	settextstyle(5,0,10); 
20+
	setviewport(getmaxx() / 8, getmaxy() / 8, 7 * getmaxx() / 8, 7 * getmaxy() / 8, 1);
21-
	outtextxy(220,30," Do thi ham so y = cos(x)");    
21+
	rectangle(0, 0, 3 * getmaxx() / 4, 3 * getmaxy() / 4);
22-
	setviewport(getmaxx()/8,getmaxy()/8,7*getmaxx()/8,7*getmaxy()/8,1); 
22+
	setfillstyle(1, YELLOW);//chon kieu duong  
23-
 	rectangle(0,0,3*getmaxx()/4,3*getmaxy()/4); 
23+
	floodfill(getmaxx() / 2, getmaxy() / 2, YELLOW);
24-
	setfillstyle(1,YELLOW);//chon kieu duong  
24+
	setviewport(getmaxx() / 2, getmaxy() / 2, 7 * getmaxx() / 8, 7 * getmaxy() / 8, 0);
25-
	floodfill(getmaxx()/2,getmaxy()/2,YELLOW);    
25+
	setcolor(BLUE);
26-
	setviewport(getmaxx()/2,getmaxy()/2,7*getmaxx()/8,7*getmaxy()/8,0); 
26+
	line(-3 * (getmaxx() / 8), 0, 3 * getmaxx() / 8, 0);
27-
	setcolor(BLUE);     
27+
	line(0, -3 * (getmaxy() / 8), 0, 3 * getmaxy() / 8);
28-
	line(-3*(getmaxx()/8),0,3*getmaxx()/8,0);     
28+
	outtextxy(0, 0, "(0,0)");
29-
	line(0,-3*(getmaxy()/8),0,3*getmaxy()/8); 
29+
	outtextxy(3 * (getmaxx() / 8) - 7, 0, "x");
30-
    outtextxy(0,0,"(0,0)");     
30+
	outtextxy(0, -3 * (getmaxy() / 8) - 7, "y");
31-
	outtextxy(3*(getmaxx()/8)-7,0,"x"); 
31+
	int x, y;
32-
    outtextxy(0,-3*(getmaxy()/8)-7,"y");     
32+
	for (int i = -400; i <= 400; ++i)
33-
	int x,y;     
33+
	{
34-
	for(int i=-400;i<=400;++i) 
34+
		//x=2*M_PI*i*20/200;   
35-
	{ 
35+
		x = 2 * M_PI*i * 20 / 200;
36-
 	//x=2*M_PI*i*20/200;  	
36+
		y = -2000 * cos(2 * M_PI*i / 200) / 60;
37-
	 x=2*M_PI*i*20/200;  	
37+
		putpixel(x, y, RED);
38-
	 y=-2000*cos(2*M_PI*i/200)/60;  	
38+
		delay(10);
39-
	 putpixel(x,y,RED);  	
39+
	}
40-
	 delay(10);       
40+
	setcolor(WHITE);
41-
} 
41+
	outtextxy(220, 200, " Thoat ESC");
42-
     setcolor(WHITE);      
42+
	char c;
43-
	 outtextxy(220,200," Thoat ESC");     
43+
	c = getch();
44-
	 char c;     
44+
	if (c == 27)
45-
	 c=getch(); 
45+
	{
46-
     if(c==27)
46+
		closegraph();
47-
	 {
47+
		menu();
48-
	 	closegraph(); 
48+
	}
49-
 		menu(); 
49+
}
50-
    } 
50+
void hsin()
51-
  } 
51+
{
52-
void hsin() 
52+
	int mh = 0, mode = 2;
53-
  { 
53+
	initgraph(&mh, &mode, "");
54-
    int mh=0,mode=2;     
54+
	setbkcolor(GREEN);
55-
	initgraph(&mh,&mode,"");     
55+
	settextstyle(5, 0, 10);
56-
	setbkcolor(GREEN);     
56+
	outtextxy(220, 30, " Do thi ham so y = sin(x)");
57-
	settextstyle(5,0,10);     
57+
	setviewport(getmaxx() / 8, getmaxy() / 8, 7 * getmaxx() / 8, 7 * getmaxy() / 8, 1);
58-
	outtextxy(220,30," Do thi ham so y = sin(x)");    
58+
	rectangle(0, 0, 3 * getmaxx() / 4, 3 * getmaxy() / 4);
59-
	setviewport(getmaxx()/8,getmaxy()/8,7*getmaxx()/8,7*getmaxy()/8,1); 
59+
	setfillstyle(1, BLUE);
60-
    rectangle(0,0,3*getmaxx()/4,3*getmaxy()/4); 
60+
	floodfill(getmaxx() / 2, getmaxy() / 2, YELLOW);
61-
	setfillstyle(1,BLUE); 
61+
	setviewport(getmaxx() / 2, getmaxy() / 2, 7 * getmaxx() / 8, 7 * getmaxy() / 8, 0);
62-
    floodfill(getmaxx()/2,getmaxy()/2,YELLOW);    
62+
	setcolor(BLACK);
63-
	setviewport(getmaxx()/2,getmaxy()/2,7*getmaxx()/8,7*getmaxy()/8,0);     
63+
	line(-3 * (getmaxx() / 8), 0, 3 * getmaxx() / 8, 0);
64-
	setcolor(BLACK);     
64+
	line(0, -3 * (getmaxy() / 8), 0, 3 * getmaxy() / 8);
65-
	line(-3*(getmaxx()/8),0,3*getmaxx()/8,0);     
65+
	outtextxy(0, 0, "(0,0)");
66-
	line(0,-3*(getmaxy()/8),0,3*getmaxy()/8); 
66+
	outtextxy(3 * (getmaxx() / 8) - 7, 0, "x");
67-
    outtextxy(0,0,"(0,0)");      
67+
	outtextxy(0, -3 * (getmaxy() / 8) - 7, "y");
68-
	outtextxy(3*(getmaxx()/8)-7,0,"x");     
68+
	int x, y;
69-
	outtextxy(0,-3*(getmaxy()/8)-7,"y");     
69+
	for (int i = -400; i <= 400; ++i)
70-
	int x,y; 
70+
	{
71-
    for(int i=-400;i<=400;++i) 
71+
		x = 2 * M_PI*i * 20 / 200;
72-
      { 
72+
		y = -2000 * sin(2 * M_PI*i / 200) / 60;
73-
 	x=2*M_PI*i*20/200;  	
73+
		putpixel(x, y, RED);
74-
	 y=-2000*sin(2*M_PI*i/200)/60;  	
74+
		delay(10);
75-
	 putpixel(x,y,RED); 
75+
	}
76-
 	delay(10); 
76+
	setcolor(WHITE);
77-
      } 
77+
	outtextxy(220, 200, " Thoat ESC");
78-
    setcolor(WHITE);      
78+
	char c;
79-
	outtextxy(220,200," Thoat ESC");     
79+
	c = getch();
80-
	char c;     
80+
	if (c == 27)
81-
	c=getch();     
81+
	{
82-
	if(c==27)       
82+
		closegraph();
83-
    {         
83+
		menu();
84-
	closegraph(); 
84+
	}
85-
 	menu(); 
85+
}
86-
      }       
86+
unsigned int visualpage, centre, stangle, endangle;
87-
} 
87+
void init()
88-
int a0,a1,r,r1,r2,r3,r4,r5,r6;
88+
{
89-
int y1,xc,yc,x1,x2,y2,x3,y3,x4,y4,x5,y5; 
89+
	int a0, a1, r, r1, r2, r3, r4, r5, r6;
90-
unsigned int visualpage,centre,stangle,endangle; 
90+
	int y1, xc, yc, x1, x2, y2, x3, y3, x4, y4, x5, y5;
91-
void init() 
91+
	int mh = 0, mode = 2;
92-
  { 
92+
	initgraph(&mh, &mode, "");
93-
    int mh=0,mode=2;     
93+
	setbkcolor(WHITE);
94-
	initgraph(&mh,&mode,"");     
94+
	setcolor(RED);
95-
	setbkcolor(WHITE);     
95+
	outtextxy(10, 10, "Bam phim Esc de thoat");
96-
	setcolor(RED); 
96+
	setcolor(YELLOW);
97-
    outtextxy(10,10,"Bam phim Esc de thoat");     
97+
	setfillstyle(1, 5);
98-
	setcolor(YELLOW);     
98+
	centre = getmaxx() / 2;
99-
	setfillstyle(1,5);     
99+
	r = getmaxy() / 8;
100-
	centre=getmaxx()/2;     
100+
	r1 = 1 + r / 2;
101-
	r=getmaxy()/8;     
101+
	r2 = 1 + r / 4;
102-
	r1=1+r/2;     
102+
	r1 = r / 10;
103-
	r2=1+r/4;     
103+
	xc = centre - r1;
104-
	r1=r/10;     
104+
	yc = 180 - r;
105-
	xc=centre-r1;     
105+
	x1 = xc - (r + r1) / 2 + 5;
106-
	yc=180-r;     
106+
	y1 = yc - (r + r1)*sqrt(3 / 4) + 5;
107-
x1=xc-(r+r1)/2+5;     
107+
	x2 = xc - (r + r2); y2 = yc - 10;
108-
y1=yc-(r+r1)*sqrt(3/4)+5;     
108+
	x3 = xc + (r + r2) / 2;
109-
x2=xc-(r+r2);y2=yc-10;     
109+
	y3 = yc - (r + r2)*sqrt(3 / 4) + 10;
110-
x3=xc+(r+r2)/2;    
110+
	x4 = x1 - (r1 / 2)*sqrt(3 / 4) + 1;
111-
y3=yc-(r+r2)*sqrt(3/4)+10;     
111+
	y4 = y1 + (r1 / 2) - 7;
112-
x4=x1-(r1/2)*sqrt(3/4)+1;     
112+
	x5 = x1 + (r1 / 2)*sqrt(3 / 4) - 1;
113-
y4=y1+(r1/2)-7;     
113+
	y5 = y1 - (r1 / 2) + 7;
114-
x5=x1+(r1/2)*sqrt(3/4)-1;     
114+
	stangle = 270;
115-
y5=y1-(r1/2)+7;     
115+
	endangle = 340;
116-
stangle=270; 
116+
}
117-
    endangle=340; 
117+
void bacnhat()
118-
  } 
118+
{
119-
void bacnhat() 
119+
	int mh = 0, mode = 2, a, b;
120-
 { 
120+
	initgraph(&mh, &mode, "");
121-
    int mh=0,mode=2,a,b;     
121+
	setbkcolor(BLUE);
122-
	initgraph(&mh,&mode,"");     
122+
	outtextxy(220, 10, " Do thi ham so y = ax+b");
123-
	setbkcolor(BLUE); 
123+
	cout << "\n";
124-
outtextxy(220,10," Do thi ham so y = ax+b"); 
124+
	cout << "    Nhap a= ";
125-
cout<<"\n"; 
125+
	cin >> a;
126-
cout <<"    Nhap a= ";
126+
	cout << "\n";
127-
cin >>a;
127+
	cout << "    Nhap b= ";
128-
cout <<"\n";
128+
	cin >> b;
129-
 cout <<"    Nhap b= ";
129+
	settextstyle(5, 0, 10);
130-
 cin>>b; 
130+
	setviewport(getmaxx() / 2, getmaxy() / 2, getmaxx(), getmaxy(), 0);
131-
 settextstyle(5,0,10); 
131+
	setcolor(WHITE);
132-
 setviewport(getmaxx()/2,getmaxy()/2,getmaxx(),get maxy(),0);     
132+
	line(-(getmaxx() / 2), 0, getmaxx() / 2, 0);
133-
 setcolor(WHITE); 
133+
	line(0, -(getmaxy() / 2), 0, getmaxy() / 2);
134-
    line(-(getmaxx()/2),0,getmaxx()/2,0);     
134+
	outtextxy(0, 0, "(0,0)");
135-
	line(0,-(getmaxy()/2),0,getmaxy()/2);     
135+
	outtextxy((getmaxx() / 2) - 10, 0, "x");
136-
	outtextxy(0,0,"(0,0)");     
136+
	outtextxy(0, (getmaxy() / 2) - 10, "y");
137-
	outtextxy((getmaxx()/2)-10,0,"x");      
137+
	setcolor(YELLOW);
138-
	outtextxy(0,(getmaxy()/2)-10,"y"); 
138+
	line(-(getmaxx() / 2) * 10, (a*(-1)*(getmaxy() / 2) + b) * 10, (getmaxx() / 2) * 10, (a*(getmaxy() / 2) + b) * 10);
139-
setcolor(YELLOW); 
139+
	delay(40);
140-
line(-(getmaxx()/2)*10,(a*(-1)*(getmaxy()/2)+b)*10,(getmaxx()/2)*10,(a*(getm axy()/2)+b)*10); 
140+
	outtextxy(200, (getmaxy() / 2) - 30, "Thoat: ESC ");
141-
delay(40); 
141+
	char c;
142-
     outtextxy(200,(getmaxy()/2)-30,"Thoat: ESC ");    
142+
	c = getch();
143-
	  char c;    
143+
	if (c == 27)
144-
	   c=getch(); 
144+
	{
145-
    if(c==27) 
145+
		closegraph();
146-
      { 
146+
		menu();
147-
 	closegraph(); 
147+
	}
148-
 	menu(); 
148+
}
149-
      } 
149+
void parabol()
150-
  } 
150+
{
151-
void parabol() 
151+
	int mh = 0, mode = 2, a, b, e, w, t;
152-
  {     
152+
	initgraph(&mh, &mode, "");
153-
int mh=0,mode=2,a,b,e,w,t;  
153+
	setbkcolor(BLUE);
154-
   initgraph(&mh,&mode,"");   
154+
	settextstyle(5, 0, 10);
155-
     setbkcolor(BLUE);   
155+
	outtextxy(220, 30, " Do thi ham so y = a*x*x+bx+c");
156-
	   settextstyle(5,0,10); 
156+
	cout << "\n";
157-
    outtextxy(220,30," Do thi ham so y = a*x*x+bx+c");  
157+
	cout << "   Nhap a=";
158-
	   cout<<"\n";   
158+
	cin >> a;
159-
	     cout<<"   Nhap a=";
159+
	cout << "   Nhap b=";
160-
	    cin>>a;
160+
	cin >> b;
161-
	        cout<<"   Nhap b="; 
161+
	cout << "   Nhap c=";
162-
			cin>>b;    
162+
	cin >> e;
163-
			 cout<<"   Nhap c=";
163+
	w = (b*b - 4 * a*e) / 2 * a;
164-
			  cin>>e;    
164+
	t = -b / (2 * a);
165-
			   w=(b*b-4*a*e)/2*a; 
165+
	setviewport(getmaxx() / 2, getmaxy() / 2, getmaxx(), getmaxy(), 0);
166-
    t= -b/(2*a);     
166+
	line(-(getmaxx() / 2), -w, getmaxx() / 2, -w);
167-
setviewport(getmaxx()/2,getmaxy()/2,getmaxx(),get maxy(),0);  
167+
	line(-t, -(getmaxy() / 2), -t, getmaxy() / 2);
168-
   line(-(getmaxx()/2),-w,getmaxx()/2,-w);   
168+
	outtextxy(0, 0, "(0,0)");
169-
     line(-t,-(getmaxy()/2),-t,getmaxy()/2);   
169+
	outtextxy((getmaxx() / 2) - 10, 0, "x");
170-
	   outtextxy(0,0,"(0,0)");    
170+
	outtextxy(0, (getmaxy() / 2) - 10, "y");
171-
	    outtextxy((getmaxx()/2)-10,0,"x"); 
171+
	float x, y, j;
172-
     outtextxy(0,(getmaxy()/2)-10,"y");  
172+
	for (int i = -200; i <= 200; ++i)
173-
	   float x,y,j;    
173+
	{
174-
	    for(int i=-200;i<=200;++i) 
174+
		x = i;
175-
      { 
175+
		y = -a*pow(x, 2) - b*x - e; j = y;
176-
 	x=i;
176+
		putpixel(x, j, YELLOW);
177-
	  y=-a*pow(x,2)-b*x-e; j=y;  	    
177+
		//           delay(0);
178-
	   putpixel(x,j,YELLOW); 
178+
	}       outtextxy(200, (getmaxy() / 2) - 30, "Thoat: ESC ");
179-
// 	     delay(0); 
179+
	char c;
180-
 	     }       outtextxy(200,(getmaxy()/2)-30,"Thoat: ESC "); 
180+
181-
 	     char c; 
181+
	c = getch();
182-
 
182+
	if (c == 27)
183-
    c=getch(); 
183+
	{
184-
    if(c==27) 
184+
		closegraph();
185-
      { 
185+
		menu();
186-
 	closegraph();  
186+
	}
187-
	 	menu();       
187+
}
188-
} 
188+
void hambac3()
189-
} 
189+
{
190-
void hambac3() 
190+
	int mh = 0, mode = 0, a, b, d, e;
191-
  { 
191+
	initgraph(&mh, &mode, "");
192-
    int mh=0,mode=0,a,b,d,e;  
192+
	setbkcolor(BLUE);
193-
	   initgraph(&mh,&mode,""); 
193+
	settextstyle(5, 0, 10);
194-
    setbkcolor(BLUE);  
194+
	outtextxy(220, 30, " Do thi ham so y = a*x*x*x");
195-
	   settextstyle(5,0,10); 
195+
	cout << "Nhap a="; cin >> a;
196-
    outtextxy(220,30," Do thi ham so y = a*x*x*x"); 
196+
	setviewport(getmaxx() / 2, getmaxy() / 2, getmaxx(), getmaxy(), 0);
197-
	    cout<<"Nhap a="; cin>>a;    
197+
	line(-(getmaxx() / 2), 0, getmaxx() / 2, 0);
198-
setviewport(getmaxx()/2,getmaxy()/2,getmaxx(),getmaxy(),0);     
198+
	line(0, -(getmaxy() / 2), 0, getmaxy() / 2);
199-
line(-(getmaxx()/2),0,getmaxx()/2,0);    
199+
	outtextxy(0, 0, "(0,0)");
200-
 line(0,-(getmaxy()/2),0,getmaxy()/2);  
200+
	outtextxy((getmaxx() / 2) - 10, 0, "x");
201-
    outtextxy(0,0,"(0,0)");    
201+
	outtextxy(0, (getmaxy() / 2) - 10, "y");
202-
	 outtextxy((getmaxx()/2)-10,0,"x"); 
202+
	float x, y, j;
203-
     outtextxy(0,(getmaxy()/2)-10,"y");  
203+
	for (int i = -200; i <= 200; ++i)
204-
	   float x,y,j;    
204+
	{
205-
	    for(int i=-200;i<=200;++i) 
205+
		x = i;
206-
      { 
206+
		y = a*pow(x, 3); j = y / 4000;
207-
 	x=i;
207+
		putpixel(x, j, YELLOW);
208-
	  y=a*pow(x,3); j=y/4000;  	
208+
		delay(10);
209-
	       putpixel(x,j,YELLOW);  	 
209+
	}
210-
		       delay(10); 
210+
	outtextxy(200, (getmaxy() / 2) - 30, "Thoat: ESC ");
211-
 	     } 	 
211+
	char c;
212-
outtextxy(200,(getmaxy()/2)-30,"Thoat: ESC "); 
212+
	c = getch();
213-
 	     char c; 
213+
	if (c == 27)
214-
    c=getch(); 
214+
	{
215-
    if(c==27) 
215+
		closegraph();
216-
      { 
216+
		menu();
217-
 	closegraph(); 
217+
	}
218-
 	menu(); 
218+
}
219-
      } 
219+
void goi(int h)
220-
} 
220+
{
221-
void goi(int h) 
221+
	if (h == 1) hsin();
222-
  {     
222+
	if (h == 2) hcos();
223-
if(h==1) hsin();   
223+
	if (h == 3) bacnhat();
224-
  if(h==2) hcos(); 
224+
	if (h == 4) parabol();
225-
      if(h==3) bacnhat();   
225+
	if (h == 5) hambac3();
226-
	    if(h==4) parabol(); 
226+
}
227-
    if(h==5) hambac3(); 
227+
void Ve(int P)
228-
  } 
228+
{
229-
void Ve(int P) 
229+
	int i;
230-
  { 
230+
	for (i = 0; i<N; ++i)
231-
     int i; 
231+
	{
232-
     for(i=0;i<N;++i) 
232+
		setbkcolor(1); setcolor(3);
233-
       { 
233+
		line(X - H, Y + i*D, X - H, Y + i*D + W);
234-
 	  setbkcolor(1);setcolor(3); 
234+
		line(X - H, Y + i*D, X, Y + i*D);
235-
	    	  line(X-H,Y+i*D,X-H,Y+i*D+W);  
235+
		line(X, Y + i*D, X, Y + i*D + W);
236-
line(X-H,Y+i*D,X,Y+i*D);  	
236+
		line(X - H, Y + i*D + W, X, Y + i*D + W);
237-
  line(X,Y+i*D,X,Y+i*D+W);  
237+
		setcolor(4);
238-
  	  line(X-H,Y+i*D+W,X,Y+i*D+W);  
238+
		if (i == 0) outtextxy(220, 60, "Do thi ham so sin(x)");
239-
			  setcolor(4); 
239+
		if (i == 1) outtextxy(220, 110, "Do thi ham so cos(x)");
240-
   if (i==0) outtextxy(220,60,"Do thi ham so sin(x)"); 
240+
		if (i == 2) outtextxy(220, 160, "Do thi ham bac nhat");
241-
   if (i==1) outtextxy(220,110,"Do thi ham so cos(x)"); 
241+
		if (i == 3) outtextxy(220, 210, "Do thi ham bac hai");
242-
   if (i==2) outtextxy(220,160,"Do thi ham bac nhat"); 
242+
		if (i == 4) outtextxy(220, 260, " Ham bac ba");
243-
 	  if (i==3) outtextxy(220,210,"Do thi ham bac hai");  
243+
		if (i == 5) outtextxy(220, 310, " Thoat chuong trinh");
244-
if (i==4) outtextxy(220,260," Ham bac ba"); 
244+
		outtextxy(100, 360, " SVTH: Phi Thi Hai Yen");
245-
   if (i==5) outtextxy(220,310," Thoat chuong trinh"); 
245+
	}
246-
       outtextxy(100,360," SVTH: Phi Thi Hai Yen"); 
246+
	setcolor(15);
247-
 	} 
247+
	line(X - H, Y + (P - 1)*D, X - H, Y + (P - 1)*D + W);
248-
     setcolor(15); 
248+
	line(X - H, Y + (P - 1)*D, X, Y + (P - 1)*D);
249-
     line(X-H,Y+(P-1)*D,X-H,Y+(P-1)*D+W);  
249+
	setcolor(8);
250-
	line(X-H,Y+(P-1)*D,X,Y+(P-1)*D);  
250+
	line(X, Y + (P - 1)*D, X, Y + (P - 1)*D + W);
251-
		     setcolor(8); 
251+
	line(X - H, Y + (P - 1)*D + W, X, Y + (P - 1)*D + W);
252-
     line(X,Y+(P-1)*D,X,Y+(P-1)*D+W); 
252+
}
253-
     line(X-H,Y+(P-1)*D+W,X,Y+(P-1)*D+W); 
253+
254-
   } 
254+
void main()
255-
 
255+
{
256-
void main() 
256+
	P = 1;
257-
  { 
257+
	menu();
258-
      P=1;     
258+
	getch();
259-
menu(); 
259+
}
260-
  getch(); 
260+
void menu()
261-
  } 
261+
{
262-
void menu() 
262+
	int mh = 0, mode = 2;
263-
  { 
263+
	char c;
264-
     int mh=0,mode=2; 
264+
	initgraph(&mh, &mode, "D:\TC\bin");
265-
     char c; 
265+
	outtextxy(200, 20, "DO THI MOT SO HAM SO SO CAP");
266-
     initgraph(&mh,&mode,"D:\TC\bin");    
266+
	Ve(P);
267-
	   outtextxy(200,20,"DO THI MOT SO HAM SO SO CAP"); 
267+
	do
268-
Ve(P); 
268+
	{
269-
     do   
269+
		c = getch();
270-
         {         
270+
		if (c == 13)        
271-
              c=getch(); 
271+
		{
272-
 	   if (c==13)  	     { 
272+
			closegraph();
273-
 	       closegraph();  	     
273+
			if (P == 6) exit(0);
274-
			  if (P==6) exit(0);  	
274+
			else
275-
			         else 
275+
				goi(P);
276-
 	 	 goi(P); 
276+
		}
277-
 	     }      
277+
		if (c == 72)
278-
 	   if (c==72) 
278+
			if (P>1)
279-
		if (P>1) 
279+
			{
280-
 	     { 
280+
				P -= 1;
281-
 	       P-=1; 
281+
				Ve(P);
282-
 	       Ve(P); 	 
282+
			}
283-
                  } 
283+
			else             
284-
 	   else  	     { 
284+
			{
285-
 	       P=N; 
285+
				P = N;
286-
 	       Ve(P); 
286+
				Ve(P);
287-
 	     } 
287+
			}
288-
if (c==80) if (P<N) 
288+
		if (c == 80) if (P<N)
289-
	 	     { 
289+
		{
290-
	 	       P+=1; 
290+
			P += 1;
291-
	 	       Ve(P); 
291+
			Ve(P);
292-
 	     } 	    else  
292+
		}
293-
              { 
293+
		else
294-
	 	       P=1; 
294+
		{
295-
	 	       Ve(P); 
295+
			P = 1;
296-
	 	     } 
296+
			Ve(P);
297-
       } 
297+
		}
298-
         while (1); 
298+
	} while (1);
299-
  }
299+
}