Exemple #1
0
int main()
{

	
	int a[40];
        srand(time(NULL));
        suiji(a);
        disp(a); 		
	return 0;
}
Exemple #2
0
void main()
{ int x,y,x0,y0;
  int flag=0;
  int flag1=1;
  struct node * head;
  struct node * head2;
  int m[1]={0};
  int r[21];
  int po1[378]={0};
  char po[24]={0};
  beijing1();
  beijing2();
  choose(po);
  mukuai();
  suiji(r,po1);
  head=creat(po1); 
//  print(head);
  while(1)
  {
    HANDLE hOut,hIn;
    DWORD Result;
    INPUT_RECORD Buf;
 
	 hOut=GetStdHandle(STD_OUTPUT_HANDLE);
	 hIn=GetStdHandle(STD_INPUT_HANDLE);
	 int a[2];
	 do
		{
			ReadConsoleInput(hIn,&Buf,1,&Result);
			if(Buf.EventType==MOUSE_EVENT)
			{
				HandleMouse(Buf.Event.MouseEvent,a);
				x=a[0];
	   			y=a[1];
			}
		} while(!(Buf.EventType==MOUSE_EVENT&&Buf.Event.MouseEvent.dwEventFlags==DOUBLE_CLICK));


  
	HANDLE hOut1,hIn1;
	DWORD Result1;
	INPUT_RECORD Buf1;
	hOut1=GetStdHandle(STD_OUTPUT_HANDLE);
	hIn1=GetStdHandle(STD_INPUT_HANDLE);
	int a0[2];
    do
		{
			ReadConsoleInput(hIn1,&Buf1,1,&Result1);
			if(Buf1.EventType==MOUSE_EVENT)
			{
				HandleMouse1(Buf1.Event.MouseEvent,a0);
				x0=a0[0];
	   			y0=a0[1];
			}
		} while(!(Buf1.EventType==MOUSE_EVENT&&Buf1.Event.MouseEvent.dwEventFlags==DOUBLE_CLICK)); 
     

	//  清屏的按钮
   /*  if(x0>=86&&x0<=100&&y0>=8&&y0<=10)
     {   clear(r,po1,po);
	     free(head);

	     continue;
	 }*/
	  if(x0>=74&&x0<=82&&y0>=25&&y0<=27)	
         flag=save(head);
	 
	  // if(x0>=85&&x0<=93&&y0>=25&&y0<=27)	
       //  open();
	 
	   if(x0>=96&&x0<=104&&y0>=25&&y0<=27)	
	   {   ////// 上次运行的结果
		   if(flag1==1)
			{ flag1=0;
		      //print(head);
		      SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|BACKGROUND_GREEN|BACKGROUND_INTENSITY);
              COORD pos1;
	          pos1.X=0;
		      pos1.Y=60;
	          SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos1);
			}  
		    
		   if(flag==1)
			{ flag=0;
		      print(head);
		      SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|BACKGROUND_GREEN|BACKGROUND_INTENSITY);
              COORD pos1;
	          pos1.X=0;
		      pos1.Y=60;
	          SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos1);
              break; 
			}
		  else if(flag==0)
			{   
			  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|BACKGROUND_GREEN|BACKGROUND_INTENSITY);
              COORD pos0;
	          pos0.X=10;
		      pos0.Y=32;
	          SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos0);
			  printf("    请您先保存 !    ");
			}
			  //   保存
	 }
		
		

     if(x0>=10&&x0<=51&&y0>=7&&y0<=28)
	 {  x0=x0/2*2;  //   取偶数点
		    if(x>=68&&x<=69&&y>=8&&y<=10)            
			{ 
				mu1(x0,y0-2,po,1);    head2=insert(po,head); // print(head2);  
			}
			          
		    else if(x>=76&&x<=81&&y==9)                
			{ 
			    mu2(x0-4,y0,po,1);    head2=insert(po,head);  // print(head2);
			}     
		    else if(x>=68&&x<=73&&y>=14&&y<=16)        
			{ mu3(x0-2,y0-1,po,1);    head2=insert(po,head);  // print(head2);   
			}    
			else if(x>=76&&x<=81&&y>=14&&y<=16)        
			{ mu4(x0-2,y0-1,po,1);      head2=insert(po,head);  // print(head2);   
			}  
			else if(x>=86&&x<=91&&y>=14&&y<=16)        
			{ mu5(x0-2,y0+1,po,1);      head2=insert(po,head);   // print(head2);   
			}   
			else if(x>=98&&x<=103&&y>=14&&y<=16)       
			{ mu6(x0-5,y0,po,1);      head2=insert(po,head);   // print(head2);    
			}                 
			else if(x>=68&&x<=73&&y>=20&&y<=22)        
			{ mu7(x0,y0-2,po,1);      head2=insert(po,head);  // print(head2);   
			}                 
			else if(x>=76&&x<=81&&y>=20&&y<=22)        
			{ mu8(x0-4,y0-1,po,1);    head2=insert(po,head);  // print(head2);    
			}
			else if(x>=86&&x<=91&&y>=20&&y<=22)        
			{ mu9(x0,y0-2,po,1);      head2=insert(po,head);  // print(head2);   
			}              
			else if(x>=99&&x<=104&&y>=20&&y<=22)       
			{ mu10(x0,y0,po,1);       head2=insert(po,head);  // print(head2);   
			} 
			else if(x>=68&&x<=71&&y>=26&&y<=28)        
			{ mu11(x0-2,y0-1,po,1);   head2=insert(po,head);  // print(head2);    
			}
	}
  }	
}