首页
编程星球
啊哈磊的小伙伴
求助
交流
添柴
挑战
题库
院校合作
加入圈子
扫码关注啊哈磊
QQ群:703568346
@啊哈编程星球
暑期课程
金牌教练带你玩转编程!
扫码预约课程
未登录
我的添柴
退出账号
啊哈磊的个人空间
https://bbs.codeaha.com/?599
[收藏]
[复制]
[分享]
[RSS]
空间首页
记录
相册
广播
主题
分享
留言板
个人资料
首页
Portal
求助
Q&A
交流
BBS
编程星球
添柴
我的空间
好友
帖子
收藏
道具
勋章
任务
相册
记录
留言板
导读
排行榜
留言板
您需要登录后才可以留言
登录
|
立即注册
留言
创世菌
2018-2-2 15:50
以前多好!
我后悔没在以前注册账号!!!现在,一切都沉寂了!每一个用户,每一位贵宾,还有——每一个管理员。
创世菌
2018-2-2 15:21
磊哥,你终于在线了!!!
zbebreak
2017-10-28 21:56
后面的Sleep(80000)改成Sleep(800)
zbebreak
2017-10-28 21:54
发个程序
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
int main()
{
char a[50][500]={"##############################",
"#O # ",
"## # ######## #######",
"### ## # ####",
"# ##############",
"##############################",
};
int i,x,y,p,q;
char ch;
x=1; y=1; p=1; q=38;
for(i=0;i<=5;i++)
puts(a
);
while(x!=p || y!=q)
{
ch=getch();
if(ch=='b')
{
if(a[x+1][y]!='#')
{
a[x][y]=' ';
x++;
a[x][y]='O';
}
}
if(ch=='g')
{
if(a[x-1][y]!='#')
{
a[x][y]=' ';
x--;
a[x][y]='O';
}
}
if(ch=='v')
{
if(a[x][y-1]!='#')
{
a[x][y]=' ';
y--;
a[x][y]='O';
}
}
if(ch=='n')
{
if(a[x][y+1]!='#')
{
a[x][y]=' ';
y++;
a[x][y]='O';
}
}
system("cls");
for(i=0;i<=5;i++)
puts(a
);
}
system("cls");
printf("you win!\n");
Sleep(80000);
return 0;
}
zbebreak
2017-10-28 21:52
好无聊的
zbebreak
2017-10-28 21:52
大家说说话呗!
wx_jQqoDqqO
2017-8-31 14:24
鱼蛋代码
2017-8-31 10:02
啊哈磊你好!
我很欣赏你的书,我有个想法我想以你的《啊哈c》这本书为教材出一系列C语言视频教程放在哔哩哔哩,请问允许吗?
逸飞扬_VbCNT
2017-8-17 14:04
啊哈磊叔叔,啊哈c好像不支持重载吧?
逸飞扬_VbCNT
2017-8-16 08:50
啊哈磊叔叔,啊哈c好像有bug,为什么?我才11岁。
卡卡欧
2016-3-5 17:09
啊哈磊叔叔
我有一个看上去比你要高级一点点的2048(如果感觉我比较自大的话请原谅,因为我真的不大会说话)请你帮我看一下好不好?
抱歉,打扰了
如有bug的话请跟我说一声
这是我的程序
#include <stdio.h>
#include <stdlib.h>
#include<time.h>
#include<conio.h>
#include<windows.h>
#define SIZE 4
static int score=0;
void putn(int n[][SIZE]);
void getn(int n[][SIZE]);
int isempty(int n[][SIZE]);
int isfull(int n[][SIZE]);
void math(int n[][SIZE],char c);
void tow(int n[][SIZE]);
void toa(int n[][SIZE]);
void tos(int n[][SIZE]);
void tod(int n[][SIZE]);
//主函数
int main()
{
system("color f0");
int i,j;
int n[SIZE][SIZE];
char c=' ';
for(i=0;i<SIZE;i++)
{
for(j=0;j<SIZE;j++)
{
n
[j]=0;
}
}
printf( "***********************\n"
"2048小游戏\n"
"按/W/A/S/D/来进行控制\n"
"按任意键继续。。。 \n"
"***********************\n",SIZE,SIZE);
getch();
system("cls");
//n[0][1]=2048;
//n[0][3]=2048;
while(1)
{
if(isempty(n))
getn(n);
putn(n);
if(!isempty(n)&&isfull(n))
break;
//sleep(200);
c=getch();
while(c!='w'&&c!='a'&&c!='s'&&c!='d')
c=getch();
math(n,c);
system("cls");
}
printf(" Game Over!\n",score);
return 0;
}
//函数
void putn(int n[][SIZE])
{
int i,j;
for(i=0;i<SIZE;i++)
{
for(j=0;j<SIZE;j++)
printf(" ");
printf("\n");
for(j=0;j<SIZE;j++)
{
if(n
[j]==0)
printf(" ");
else
printf("%4d ",n
[j]);
}
printf("\n");
for(j=0;j<SIZE;j++)
printf("_____");
printf("\n");
}
printf("score: %d",score);
}
void getn(int n[][SIZE])
{
int a,b;
a=rand()%SIZE;
b=rand()%SIZE;
while(n[a]
!=0)
{
a=rand()%SIZE;
b=rand()%SIZE;
}
n[a]
=2;
}
int isempty(int n[][SIZE])
{
int i,j,count=0;
for(i=0;i<SIZE;i++)
for(j=0;j<SIZE;j++)
if(n
[j]==0)
count++;
return count;
}
int isfull(int n[][SIZE])
{
int i,j,count=0;
for(i=0;i<SIZE;i++)
{
for(j=1;j<SIZE-1;j++)
{
if(n
[j]==n
[j+1]||n
[j]==n
[j-1])
count++;
}
}
for(j=0;j<SIZE;j++)
{
for(i=1;i<SIZE-1;i++)
{
if(n
[j]==n[i+1][j]||n
[j]==n[i-1][j])
count++;
}
}
return count>0?0:1;
}
void math(int n[][SIZE],char c)
{
switch(c)
{
case 'w':tow(n);break;
case 'a':toa(n);break;
case 's':tos(n);break;
case 'd':tod(n);break;
default :;
}
}
void tow(int n[][SIZE])
{
int i,j,a;
int m[SIZE];
for(a=0;a<SIZE;a++)
m[a]=0;
for(j=0;j<SIZE;j++)
{
for(a=0;a<SIZE;a++)
{
for(i=0;i<SIZE-1;i++)
{
if(n
[j]==0)
{
n
[j]=n[i+1][j];
n[i+1][j]=0;
}
}
}
}
for(j=0;j<SIZE;j++)
{
for(a=0,i=0;i<SIZE;i++)
{
if(n
[j]!=n[i+1][j]&&n
[j]!=0||n
[j]==2048)
{
m[a++]=n
[j];
n
[j]=0;
}
else if(n
[j]==n[i+1][j])
{
m[a++]=n
[j]+n[i+1][j];
score+=m[a-1];
n
[j]=0,n[i+1][j]=0;
}
}
for(i=0;i<SIZE;i++)
{
n
[j]=m
;
m
=0;
}
}
}
void toa(int n[][SIZE])
{
int i,j,a;
int m[SIZE];
for(a=0;a<SIZE;a++)
m[a]=0;
for(i=0;i<SIZE;i++)
{
for(a=0;a<SIZE;a++)
{
for(j=0;j<SIZE-1;j++)
{
if(n
[j]==0)
{
n
[j]=n
[j+1];
n
[j+1]=0;
}
}
}
}
for(i=0;i<SIZE;i++)
{
for(a=0,j=0;j<SIZE;j++)
{
if(n
[j]!=n
[j+1]&&n
[j]!=0||n
[j]==2048)
{
m[a++]=n
[j];
n
[j]=0;
}
else if(n
[j]==n
[j+1])
{
m[a++]=n
[j]+n
[j+1];
score+=m[a-1];
n
[j]=0,n
[j+1]=0;
}
}
for(j=0;j<SIZE;j++)
{
n
[j]=m[j];
m[j]=0;
}
}
}
void tos(int n[][SIZE])
{
int i,j,a;
int m[SIZE];
for(a=0;a<SIZE;a++)
m[a]=0;
for(j=SIZE-1;j>=0;j--)
{
for(a=SIZE-1;a>=0;a--)
{
for(i=SIZE-1;i>0;i--)
{
if(n
[j]==0)
{
n
[j]=n[i-1][j];
n[i-1][j]=0;
}
}
}
}
for(j=SIZE-1;j>=0;j--)
{
for(a=SIZE-1,i=SIZE-1;i>=0;i--)
{
if(n
[j]!=n[i-1][j]&&n
[j]!=0||n
[j]==2048)
{
m[a--]=n
[j];
n
[j]=0;
}
else if(n
[j]==n[i-1][j])
{
m[a--]=n
[j]+n[i-1][j];
score+=m[a+1];
n
[j]=0,n[i-1][j]=0;
}
}
for(i=SIZE-1;i>=0;i--)
{
n
[j]=m
;
m
=0;
}
}
}
void tod(int n[][SIZE])
{
int i,j,a;
int m[SIZE];
for(a=0;a<SIZE;a++)
m[a]=0;
for(i=SIZE-1;i>=0;i--)
{
for(a=SIZE-1;a>=0;a--)
{
for(j=SIZE-1;j>0;j--)
{
if(n
[j]==0)
{
n
[j]=n
[j-1];
n
[j-1]=0;
}
}
}
}
for(i=SIZE-1;i>=0;i--)
{
for(a=SIZE-1,j=SIZE-1;j>=0;j--)
{
if(n
[j]!=n
[j-1]&&n
[j]!=0||n
[j]==2048)
{
m[a--]=n
[j];
n
[j]=0;
}
else if(n
[j]==n
[j-1])
{
m[a--]=n
[j]+n
[j-1];
score+=m[a+1];
n
[j]=0,n
[j-1]=0;
}
}
for(j=SIZE-1;j>=0;j--)
{
n
[j]=m[j];
m[j]=0;
}
}
}
邀请码
2016-2-19 21:52
磊哥,加个友链!我已经加上了!
http://code.88448.com/
首子道
2015-9-23 18:28
啊哈磊,《伟大思维闪耀时》什么时候出?
cjk
2015-8-10 21:40
嘿,啊哈磊!
交个朋友呗。
Kimiwang828
2015-4-3 20:55
在哪里下载呢?
bun
2015-2-13 09:59
你的网站速度真心快
bun
2015-2-13 09:58
ahalei,你好啊,我非常喜欢你的编译器的风格,我提一点点建议,希望添加快捷键:运行Ctrl+R(也许我不知道运行的快捷键 ),还有就是每次运行能不能不要弹出对话框,每次都要点确定。多此一举了。最后还是点个赞
mayue123
2015-1-30 17:28
你好 磊哥 我本人是高一新生,学习成绩超级无敌差 基本上成 年级倒数了 数学成绩也是出乎意料的差,我不想再上下去了,没意思,上个教编程的中专 这样行吗,我对编程有点兴趣,也不能说是很强的兴趣。额额额。煎熬。。。现在在逃课。。。。
Carter0605
2015-1-22 21:26
磊哥,跟你反馈一个问题.
我今天显得无聊,在网上百度我的ID
第一个蹦出来的是我在啊哈磊论坛上的东西
我点开一看,是我的个人空间
里面有:
生日2015 年 1 月 1 日居住地海外 英国性别男
活跃概况
用户组 白手起家
在线时间3 小时注册时间2015-1-18 18:48最后访问2015-1-22 19:32注册 IP110.112.20.190 - - 黑龙江上次访问 IP110.112.23.244:57428 - - 黑龙江上次活动时间2015-1-22 15:59上次发表时间2015-1-22 19:35所在时区使用系统默认
等等信息
先不说别的.
我的生日,居住地之类的,我设置的是保密.
为什么还要公开?
啊哈磊论坛是我第一个信任的论坛,本打算今晚拍下啊哈C和啊哈算法.
可是现在,对个人信息这透明度,百分百?
心里一颤,如果是网站原因,请尽快修复,如果是您主观这样设置的,那
这就是个问题了.至于由此引发的种种潜在后果,现在我不好下定论.
请磊哥看到后尽快回复.
(荐)或联系我邮箱yuheng0605@yeah.net
我认为,这种事情是很严肃的,敬请尽快解决,谢谢
Cminister
2014-11-22 08:43
添柴邀请码 求你了磊哥给我两个吧
1
2
3
4
/ 4 页
下一页
啊哈磊
查看广播
收听TA
加为好友
给我留言
打个招呼
发送消息
返回顶部