数独 彩色
c4droid吧
全部回复
仅看楼主
level 5
yx8njwl 楼主
网盘链接
前天无聊编的数独,话说对我这种代码敲的少的来说,算法还不简单了,比24点麻烦。上面是分享链接~可以分难易随机出题~还可以输入题目自动解题~
2016年02月15日 00点02分 1
level 13
加油吧。
2016年02月15日 01点02分 2
level 13
qt敲的?
2016年02月15日 08点02分 3
不,纯控制台
2016年02月15日 23点02分
level 5
yx8njwl 楼主
/* 2016.2.13 */
/* 极好用的LinuxConsole头文件 */
/* 1.定位 2.清屏 3.颜色 4.按键 */
/* c4droid所用代码 */
#include<iostream>
using namespace std;
#include<stdlib.h>
#include<conio.h>
#include<time.h>
#define Cin(i) (!(cin>>i)||cin.peek()!='\n') //输入并如果未按要求输入
void cinignore() //近似清除输入流缓存(有时需要回车继续)
{
cin.clear();
cin.ignore(1024,'\n');
}
char waitkey(float n) //等待并在n秒内检测是否按键
{
n*=1000;
clock_t t=clock();
while((clock()-t)<n)
if(kbhit()) //检测是否有键盘输入
return getch(); //读取按键(ascii码)win里按回车读'\r'
return 0;
}
void hide(int i)
{
if(i)printf("\033[?25h"); //显示光标
else printf("\033[?25l"); //隐藏光标(可再将文字与背景设成同色)
}
void color(int f=37,int b=40,bool h=0) //h为高亮属性
{
if(h)printf("\033[1m");
else printf("\033[0m");
printf("\033[%d;%dm", b, f);
}
/* 颜色ANSI控制码
背景颜色: 40--49 字体颜色: 30--39
40: 黑 30: 黑
41: 红 31: 红
42: 绿 32: 绿
43: 黄 33: 黄
44: 蓝 34: 蓝
45: 紫 35: 紫
46: 深绿 36: 深绿
47: 白色 37: 白色 */
#define clrline() printf("\033[2K")
//清除光标当前行
#define clrup() printf("\033[1J")
//清除从屏首到光标的内容
#define clrdown() printf("\033[J")
//清除从光标到屏尾的内容
#define clrright() printf("\033[K")
//清除从光标到行尾的内容
#define clrleft() printf("\033[1K")
//清除从光标到行首的内容
#define cpup(y) printf("\033[%dA", (y))
//CursorPositionUp
#define cpdown(y) printf("\033[%dB", (y))
//CursorPositionDown
#define cpleft(x) printf("\033[%dD", (x))
//CursorPositionLeft
#define cpright(x) printf("\033[%dC", (x))
//CursorPositionRight
#define savecp() printf("\0337")
//SaveCursorPosition&Attrs
#define recp() printf("\0338")
//RestoreCursorPosition&Attrs
/* 以下直接用:
gotoxy(x,y); //光标移到屏幕(x,y)的位置以便输出,从(1,1)开始
clrscr(); //清屏(只能清除当前屏幕)
system("clear") //清屏(只能清除当前屏幕)
sleep(n); //延时等待n秒
usleep(n); //延时等待n微秒
srand(time(0)); //重置随机函数初始值
//<time.h>下有很多与读取时间相关的代码
struct tm *t1;
time_t t0=time(0);
t1=localtime(&t0);
//t1->tm_sec,tm_min,tm_hour,tm_mday,tm_mon,tm_year+1900,tm_wday,tm_yday;
Label:
goto label; //破坏结构,不清晰,不易读,但灵活
*/
/* 备注:
在C4droid设置默认模式参数后面加上 -fPIE -pie
否则导出的程序将无法在安卓5.0及以上系统运行
*/
2016年02月15日 23点02分 4
头文件
2016年02月15日 23点02分
对于初识linux平台的童鞋这段头文件还是很好用滴~
2016年02月18日 19点02分
1