看了校报,发现有一行挺好玩的代码,于是做了一些小修改。


  1. int c[]={1398227295,6245697}; 
  2. puts((char *)c); 

 输出结果是:

一些有趣的程序   (闲着没事写点好玩的东西.....)

 那么这个数字是怎么来的呢?


  1. char str[]="_AWSAM_";    
  2. int *a=(int *)str; 
  3. int *b=(int *)(str+4); 
  4. cout<<*a<<endl<<*b<<endl; 
就是这样来的。。

指针真是灵活啊。。 


突然发神经想知道电脑对我的看法,于是我问电脑:


  1. #include <stdio.h> 
  2. void main() 
  3.  
  4.  
  5. printf("WHAT DO YOU THINK OF AWSAM? \n"); 
  6.  
  7. /// Tell me,please ! \\\ 
  8.  
  9. printf("AWSAM is foolish \n"); 
  10.  
  11. printf("AWSAM is WISER \n"); 
  12.  

然后它告诉我:

一些有趣的程序   (闲着没事写点好玩的东西.....)

 

一些有趣的程序   (闲着没事写点好玩的东西.....) 

 

 =================================================================

 

//这短短的几行代码可以模拟***帝国的那种字符流效果

一些有趣的程序   (闲着没事写点好玩的东西.....)

 

 

 


  1. #include<stdio.h> 
  2. #include <windows.h> 
  3. void main() 
  4.  char * p=(char *)main; 
  5.  int end=(int)main+150000; 
  6. while((int)p<end) 
  7.  printf("%c\t",*p++); 
  8.  Sleep(3); 

////////////////////////////////////////////////////////////////

下雪


  1. #include<stdio.h> 
  2. #include <windows.h> 
  3. #include <time.h> 
  4. void snow(); 
  5. void main() 
  6. snow(); 
  7. void snow() 
  8.  srand(time(NULL)); 
  9.  HDC hdc=CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL); 
  10.   
  11.  for(int x=0;x<90000;x++) 
  12.  { 
  13.  SetPixel(hdc,rand()%1500,rand()%1000,RGB(255,255,255)); 
  14.  Sleep(1); 
  15.  } 
  16.  ReleaseDC(0,hdc);