当前位置:首页 » 编程语言 » 恶搞朋友的c语言代码
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

恶搞朋友的c语言代码

发布时间: 2023-08-13 07:48:18

A. 一个c语言恶搞程序

#include<stdio.h>
#include<string.h>//
intmain(void)
{
charch[8];
printf("请输入您的名字拼音,我可以算出你的智商哦!");
while(1)//
{
scanf("%s",ch);//
if(!strcmp(ch,"langtian"))//
{
printf("真是个大帅哥啊,智商达1000 ");
}else{
printf("猪头吗? 猪头呀! ");
}
}
return0;
}

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

#include "stdio.h"
#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. 求C语言编写的表白程序,要代码

呃,你还不如用vbs,网上也有一堆教程和例子,很简单,随便看一下就知道怎么写了。

DimmyName,herName,myNameAns,herNameAns
myName="池早早"
herName="欧浩辰"
MsgBox(herName+",我喜欢你!我的脑和心,我全身上下每一个器官都在说着我喜欢你。")
do
herNameAns=InputBox("我喜欢谁?","某人的名字")
loopwhileherNameAns<>herName
do
myNameAns=InputBox("谁喜欢"+herName+"?","某人的名字")
loopwhilemyNameAns<>myName
do
myNameAns=InputBox("大声点我听不见!","你的名字")
loopwhilemyNameAns<>myName
MsgBox(herName+",这是我为你准备的药,你趁热吃吧!")

.........................保存为xxx.vbs文件就能运行了

D. 求几个比较有趣,简单的C语言源代码 小白自己敲着练一下手感

最简单的模拟计时器:

#include<stdio.h>

#include<conio.h>

#include<windows.h>

int m=0,s=0,ms=0; //m是分 s是秒 ms是毫秒

//以下是5个自编函数

void csh( ); //初始化界面

void yinc(int x,int y); //隐藏光标的函数(y值设为0就会隐藏)

void jishi( ); //计时器运行(每100毫秒变化一次)

void Color (short x, short y); //设定颜色的函数(y设为0就是黑底)

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

int main( ) //主函数

{ csh( );

getch( );

while(1)

{ jishi( );

Sleep(100); //间隔100毫秒

if( kbhit( ) )break; //有键按下就退出循环

}

return 0;

}

void csh( ) //初始化界面

{Color(14,0); //设定淡黄字配黑底

printf(“ 计时器”);

Color(10,0); //设定淡绿字配黑底

printf(" ┌───────────┐");

printf(" │ │");

printf(" └───────────┘");

gtxy(10,4); //光标到屏幕第10列4行处输出

Color(7,0); //恢复白字黑底

printf(" 00:00:00 ");

yinc(1,0 ); //隐藏光标(yinc代表隐藏)

return;

}

void jishi( ) //计时器运行

{ms+=1;

if(ms==10){s+=1;ms=0;}

if(s==60){m+=1;s=0;}

gtxy(10,4);

Color(9,0); //设定淡蓝字配黑底

if(m>9) printf(" %d:",m);

else printf(" 0%d:",m);

Color(14,0); //设定淡黄字配黑底

if(s>9) printf("%d:",s);

else printf("0%d:",s);

Color(12,0); //设定淡红字配黑底

printf("0%d",ms);

}

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

{ COORD pos;

pos.X = x;

pos.Y = y;

SetConsoleCursorPosition ( GetStdHandle (STD_OUTPUT_HANDLE), pos );

}

void Color (short ForeColor= 7, short BackGroundColor= 0) //设定颜色的函数

{ HANDLE handle = GetStdHandle ( STD_OUTPUT_HANDLE );

SetConsoleTextAttribute ( handle, ForeColor + BackGroundColor * 0x10 );

}

void yinc(int x,int y) //隐藏光标的设置(gb代表光标)

{ CONSOLE_CURSOR_INFO gb={x,y}; //x为1-100,y为0就隐藏光标

SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &gb);

}

E. 求助啊,谁有有趣的c语言小程序,并且要有源代码!!

一个贪吃蛇C源代码,本人稍加优化,练手应当不错。
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <time.h>
#include <Windows.h>

#define WIDTH 78 //地图的宽,x轴
#define HEIGHT 26 //地图的高,y轴
int dire=3; //方向变量,初值为向“左”
int Flag=0; //判断是否吃了食物的标志
int score=0; //玩家得分

struct foods{ int x;
int y;
}food; //结构体food有2个成员
struct snakes{int len;
int speed;
int x[100];
int y[100];
}snake; //结构体snake有4个成员

void gotoxy( int x,int y) //获得句柄,才能控制光标移动
{ COORD coord;
coord.X=x;
coord.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}

void gotoxy( int x,int y); //以下声明要用到的几个自编函数
void csh( );
void keyDown( );
void Move( );
void putFood( );
int pdOver( );

int main( ) //主函数
{ csh( );
while(1)
{ keyDown( );
Move( );
putFood( );
if(pdOver( ))
{system(“cls”);
gotoxy(WIDTH/2+1,HEIGHT/2);
printf(“游戏结束!T__T”);
gotoxy(WIDTH/2+1,HEIGHT/2+1);
printf(“玩家总分:%d分”,score);
getch( );
break; }
Sleep(snake.speed);
}
return 0;
}

void csh( ) //初始化界面
{ int i;
gotoxy(0,0);
CONSOLE_CURSOR_INFO cursor_info={1,0}; //光标值设为0就隐藏了
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);

for(i=0;i<=WIDTH;i=i+2) //横坐标要为偶数,因为这里要打印的字符占2个位置
{ gotoxy(i,0); //打印上边框
printf("■");
gotoxy(i,HEIGHT); //打印下边框
printf("■");
}
for(i=1;i<HEIGHT;i++)
{ gotoxy(0,i); //打印左边框
printf("■");
gotoxy(WIDTH,i); //打印右边框
printf("■");
}
while(1)
{ srand((unsigned int)time(NULL)); //设定种子为当前时间
food.x=rand()%(WIDTH-4)+2;
food.y=rand()%(HEIGHT-2)+1;
if(food.x%2==0)break;
}
gotoxy(food.x,food.y); //到食物坐标处打印初试食物
printf("●");

snake.len=3; //蛇身长
snake.speed=350; //刷新蛇的时间,即是移动速度
snake.x[0]=WIDTH/2+1; //蛇头横坐标为偶数
snake.y[0]=HEIGHT/2; //蛇头纵坐标
gotoxy(snake.x[0], snake.y[0]); //打印蛇头
printf("■");

for(i=1;i<snake.len;i++)
{ snake.x[i]=snake.x[i-1]+2;
snake.y[i]=snake.y[i-1];
gotoxy(snake.x[i],snake.y[i]); //打印蛇身
printf("■");
}
return;
}

void keyDown( ) //按键操作
{ int key;
if(kbhit( )) //如有按键输入才执行下面操作
{ key=getch( );
if(key==224) //值为224表示按下了方向键,下面要再次获取键值
{ key=getch( );
if(key==72&&dire!=2)dire=1; //72为向上
if(key==80&&dire!=1)dire=2; //80为向下
if(key==75&&dire!=4)dire=3; //75为向左
if(key==77&&dire!=3)dire=4; //77为向右
}
if(key==13)
{ while(1) if((key=getch( ))==13) break; } //13为回车键,这儿用来暂停
}
}

void Move( ) //蛇移动一节
{ if(Flag==0) //如没吃食物,才执行下面操作擦掉蛇尾
{ gotoxy(snake.x[snake.len-1],snake.y[snake.len-1]);
printf(" ");
}
int i;
for (i = snake.len - 1; i > 0; i--) //从蛇尾起每节存储前一节坐标值(蛇头除外)
{ snake.x[i]=snake.x[i-1];
snake.y[i]=snake.y[i-1];
}
switch (dire) //以下判断蛇头该往哪个方向移动,并获取最新坐标值
{ case 1: snake.y[0]--; break;
case 2: snake.y[0]++; break;
case 3: snake.x[0]-=2; break;
case 4: snake.x[0]+=2; break;
}
gotoxy(snake.x[0], snake.y[0]); //打印蛇头
printf("■");
if (snake.x[0] == food.x && snake.y[0] == food.y) //如吃到食物执行以下操作
{ snake.len++; score += 50; snake.speed -= 5; Flag = 1;}
else Flag = 0;
if(snake.speed<160) snake.speed= snake.speed+5; //作弊码,不让速度无限加快
}

void putFood( ) //投放食物
{ if(Flag == 1) //如吃到食物才执行以下操作,生成另一个食物
{ while (1)
{ int i,n= 1;
srand((unsigned int)time(NULL)); //设定当前时间,接下产生食物坐标值
food.x = rand( ) % (WIDTH - 4) + 2;
food.y = rand( ) % (HEIGHT - 2) + 1;
for (i = 0; i < snake.len; i++) //随机生成的食物不能在蛇的身体上
{ if (food.x == snake.x[i] &&food.y == snake.y[i])
{ n= 0; break;}
}
if (n && food.x % 2 == 0) break; //n不为0且横坐标为偶数,食物坐标取值成功
}
gotoxy(food.x, food.y); //光标到取得的坐标处打印食物
printf("●");
}
return;
}

int pdOver( ) //判断游戏是否结束
{ int i;
gotoxy(2,HEIGHT+1); //以下打印一些其它信息
printf(“暂停键:Enter.”);
gotoxy(2,HEIGHT+2);
printf(“游戏得分:%d”,score);
if (snake.x[0] == 0 || snake.x[0] == WIDTH) return 1; //蛇头触碰左右边界
if (snake.y[0] == 0 || snake.y[0] == HEIGHT) return 1; //蛇头触碰上下边界
for (i = 1; i < snake.len; i++)
{ if (snake.x[0] == snake.x[i] && snake.y[0] == snake.y[i]) return 1; } //蛇头触碰自身
return 0;
}

F. 哪位大神有c语言做的小人的代码,什么小人都可以,什么叮当猫hellokitty

#include<stdio.h>

intmain(){
char*s[]={"______________$$$$$$$",
"_____________$$$$$$$$$",
"____________$$$$$$$$$$$",
"____________$$$$$$$$$$$",
"____________$$$$$$$$$$$",
"_____________$$$$$$$$$",
"_____$$$$$$_____$$$$$$$$$$",
"____$$$$$$$$__$$$$$$_____$$$",
"___$$$$$$$$$$$$$$$$_________$",
"___$$$$$$$$$$$$$$$$______$__$",
"___$$$$$$$$$$$$$$$$_____$$$_$",
"___$$$$$$$$$$$__________$$$_$_____$$",
"____$$$$$$$$$____________$$_$$$$_$$$$",
"______$$$__$$__$$$______________$$$$",
"___________$$____$_______________$",
"____________$$____$______________$",
"_____________$$___$$$__________$$",
"_______________$$$_$$$$$$_$$$$$",
"________________$$____$$_$$$$$",
"_______________$$$$$___$$$$$$$$$$",
"_______________$$$$$$$$$$$$$$$$$$$$",
"_______________$$_$$$$$$$$$$$$$$__$$",
"_______________$$__$$$$$$$$$$$___$_$",
"______________$$$__$___$$$______$$$$",
"______________$$$_$__________$$_$$$$",
"______________$$$$$_________$$$$_$_$",
"_______________$$$$__________$$$__$$",
"_____$$$$_________$________________$",
"___$$$___$$______$$$_____________$$",
"__$___$$__$$_____$__$$$_____$$__$$",
"_$$____$___$_______$$$$$$$$$$$$$",
"_$_____$____$_____$$$$$$__$$$$$$$$"};

intLENGTH=32;
inti=0;
for(i=0;i<LENGTH;i++){
printf("%s ",s[i]);
}
}

G. 求一段整人C语言小程序

给你最简单的,那有时间编那个,这个文件是批处理,打开记事本,输入第一行@echo off,第二行 start cmd,第三行,%0然后保存成文件类型为bat文件。然后你打开那个文件试一试。保证,你会很爽的,放心只是恶搞。