barriers / 阅读 / 详情

什么C语言中circle函数

2023-06-20 15:40:46
TAG: irc rcl
共2条回复
苏萦

函数名: circle 功 能: 在给定半径以(x, y)为圆心画圆 用 法: void far circle(int x, int y, int radius); 程序例: #include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int midx, midy; int radius = 100; /* initialize graphics and local variables */ initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ { printf("Graphics error: %s ", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* terminate with an error code */ } midx = getmaxx() / 2; midy = getmaxy() / 2; setcolor(getmaxcolor()); /* draw the circle */ circle(midx, midy, radius); /* clean up */ getch(); closegraph(); return 0; }

豆豆staR

这是TURBO C提供的图形接口,用来画圆。不属于标准库函数,不具备可移植性。

函数名:circle

功 能: 在给定半径以(x, y)为圆心画圆

用 法:void far circle(int x, int y, int radius)

例程:

#include <graphics.h>

#include <stdlib.h>

#include <stdio.h>

#include <conio.h>

int main(void)

{

/* request auto detection */

int gdriver = DETECT, gmode, errorcode;

int midx, midy;

int radius = 100;

/* initialize graphics and local variables */

initgraph(&gdriver, &gmode, "");

/* read result of initialization */

errorcode = graphresult();

if (errorcode != grOk) /* an error occurred */

{

printf("Graphics error: %s ", grapherrormsg(errorcode));

printf("Press any key to halt:");

getch();

exit(1); /* terminate with an error code */

}

midx = getmaxx() / 2;

midy = getmaxy() / 2;

setcolor(getmaxcolor());

/* draw the circle */

circle(midx, midy, radius);

/* clean up */

getch();

closegraph();

return 0;

}

相关推荐

grok 是什么语法

grok 英[gru0252k] 美[grɑ:k] v. 通过感觉意会; [例句]Eventually, the player uses an existing skill to grok another skill.最终,玩家用已有的技能去获得新技能。
2023-06-20 08:16:241

grok怎么匹配多个正则表达式

^.{4}(.{4}).(.{6}).{6}(.{12})或者^(?:.{4})(?.{4})(?:.{1})(?.{6})(?:.{6})(?.{12})直接匹配然后获取分组应该是效率最高的吧。因为字符串都是不定长的,所以应该没有更好的方案了。
2023-06-20 08:16:321

Turbo c 提示我grOK未定义

分类: 电脑/网络 >> 程序设计 >> 其他编程语言 问题描述: #include<graphics.h> #include<math.h> #include<conio.h> #include<stdio.h>#include<stdlib.h> #include<dos.h> double EarthX,EarthY,CircleX,CircleY; /*全局变量说明*/ void DrawRun(int X,int Y,double i,int r,int Run_r,int Color)/*自定义DrawRun()函数,功能是在指定的位置上画指定的实心圆*/ { setcolor(Color); /*设置不同颜色*/ setfillstyle(SOLID_FILL,Color); /*设置填充格式及颜色*/ i=(i*1.74444)/100; /*将i转换为弧度*/ CircleX=Run_r*cos(i)+X; /*求圆心横坐标*/ CircleY=Run_r*sin(i)+Y; /*求圆心纵坐标*/ fillellipse(CircleX,CircleY,r,r); /*填充以(CircleX,CirecleY)为圆心,以r为半径的圆*/ } void EraseRun(int X,int Y,double i,int r,int Run_r) /*自定义EraseRun()函数,功能是在指定的位置上用黑色擦图实心圆*/ { setfillstyle(SOLID_FILL,BLACK); /*设置填充格式及颜色*/ i=(i*174444)/100; CircleX=Run_r*cos(i)+X; CircleY=Run_r*sin(i)+Y; setcolor(BLACK); /*设置颜色*/ fillellipse(CircleX,CircleY,r,r); } void main() { int gdriver=DETECT,gmode,ErrorCode; int CircleX1,CircleY1,r; int i,j,k,ks; initgraph(&gdriver,&gmode,"D:\Program Files\WINYES\TC20H"); ErrorCode=graphresult(); /*求初始化图形返回的结果*/ if(ErrorCode!=grOK) /*如果图形初始化失败,则输出错误信息,然后退出程序*/ { printf("Graphoce error: %s ", grapherrormsg(ErrorCode)); exit(1); } CircleX1=getmaxx()/2; /*计算出显示窗口水平方向的中点*/ CircleY1=getmaxy()/2; /*计算出现实窗口垂直方向的中点*/ outtextxy(0,0,"Sun,Earth,Moon"); /*从指定坐标(0,0)输出文字"Sun,Earth,Moon" */ /*以下几行语句画太阳*/ setcolor(LIGHTRED); /*设置颜色*/ setfillseyle(SOLID_FILL,LIGHTRED); /*设置填充方式为实现填充,颜色为淡红色*/ fillellipse(CircleX1,CircleY1,35,35); /*填充以(CircleX1,CircleY1)为圆心,半径为35的圆*/ setcolor(WHITE); /*设置下一语句中输出文字的字体颜色为白色*/ outtextxy(CircleX1-10,CircleY1,"wpc"); /*在指定的坐标位置上输出 "wpc"*/ for(j=1;j<=3;j++) { ks=0; for(i=0;i<=360;i++) { DrawRun(CircleX1,CircleY,i,15,180,LIGHTBLUE);/*调用自定义函数DrawRun()画地球*/ EarthX=CircleX; EarthY=CircleY; for(k=1;k<=12;k++) /*月亮围绕地球转12圈*/ { ks=ks+1; DrawRun(EarthX,EarthY,ks,5,50,WHITE); /*调用自定义函数DrawRun()画月亮*/ if(kbhit())break;else dalay(50); EraseRun(EarthX,EarthY,ks,5,50); /*调用自定义函数EraseRun()擦除月亮*/ } EraseRun(CircleX1,CircleY1,i,15,180); /*调用自定义函数EraseRun()擦除地球*/ if(kbhit())break; /*敲击键盘停止动画*/ } } getchar(); /*从键盘上读取一个字符*/ closegraph(); /*关闭图形*/ } 求解...谢谢....~~ 解析: 晕了,注意看仔细了,正确的是grOk不是grOK,那个OK后面的k是小写! 还有两个小问题:有个setfillseyle改成setfillstyle,有个dalay改成delay 然后程序运行了,看不懂你画的是什么........
2023-06-20 08:16:391

grok debugger怎么用

网页链接找到一个在线调试的工具
2023-06-20 08:16:482

Logstash Filter 中文解读

grok可以解析任意的文本并将其结构化。 该工具在针对syslog, apache或者其他的webserver或者例如mysql跟其他一些杂七杂八的东西会特别好用=- =。而且对log的格式化仅仅是为了数据显示更加人性化,不会增加计算消耗。 Logstash本身针对不同语言有120种默认的匹配模式(实际上很容易看到是正则表达式),你也可以写你自己的表达式并且提一个pull request; Grok 通过将文本标签与log内容进行匹配实现格式化。 格式:%{SYNTAX:SEMANTIC} SYNTAX是标签的名字,SEMANTIC是通过标签映射得到的数据的存放变量。 默认情况下所有字段的存储类型为String,如果你希望其他的存储类型 %{NUMBER:num:int} 使用这种匹配将产生int类型的字段 直接用这个就能自定义一个正则把数据存入field_name. 也可以写文件自定义一个pattern 最常用的就是对message字段进行格式化 } 如果想对同一个字段多次格式化 其中"Duration: "是正则直接匹配相对应的字符,%{}是grok的匹配标签,前者为正则后者为字段 没错很好用,每一款filter都可以加这个玩意儿 字面意思, 删除某些字段 值得注意的是某些标签的使用需要在过滤器成功工作的前提下,如果你的标签没有效果,记得检查一下前面的过滤主体(有的标签必须在有过滤得情况下才能起作用) 该过滤器的目的是将多条消息的数据聚合成一条消息,提供"code"字段可以对int属性进行自定义的增加减少,然后丢到某一个最终消息中去,然后进入output过程。 不过为了使用这个过滤器,你需要将Logstash的过滤器参数设置为1 (-w 1 flag)这样该过滤器才能正确工作。否则会掉头发。 总的来说是一个很迷的过滤器,请尽量在来源或者Kibana中完成消息聚合, 使用该Filter极其麻烦。 拒绝翻译这个东西 = = 英文文档 变形(?)过滤器。 允许你对字段做一般的改变。 你可以 改名 , 删除 , 替代 , 修改 收到消息中的参数。 如果你认真读了上面的你会发现grok也提供删除字段的功能。实际上相当多的过滤器提供了大量的重复功能,不过我认为针对不同操作尽量调用相对应的过滤器会令配置简洁明了。 其中涉及到True False有一些转换的规则,详情请从title下面的英文文档链接点进去。(没错自己看吧hhhh) 你会发现有两个反斜杠,这没错,你需要给正则里面的所有反斜杠加反斜杠。。。我知道这有点绕口hhh。 hash也可以merge 反正你自己玩=。= 日期过滤器是一个用来解析日期格式的过滤器,并将解析出来的日期作为logstash的时间戳使用。 栗子 日期过滤器是一个对整理消息重新回填旧数据非常重要的过滤器。如果你没有在你的消息中正确的获取到时间,那么之后对他们的搜索很可能会失去顺序。 如果没有该过滤器并且时间中没有设置时间戳,logstash会根据他首次获取到消息的时间设置时间戳,比如从文件中读取消息,那么每次读取的时间将会作为时间戳。
2023-06-20 08:16:551

python web开发 用什么工具

.........
2023-06-20 08:17:064

与understand意思相近的词

know
2023-06-20 08:18:252

帮忙解释一下这个程序

#include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> //以上为包含 头文件int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int midx, midy; int radius = 100; /* initialize graphics and local variables */ initgraph(&gdriver, &gmode, ""); //初始化图形系统/* read result of initialization */ errorcode = graphresult(); //获得初始化结果if (errorcode != grOk) /* an error occurred *///如果发生错误 { printf("Graphics error: %s ", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* terminate with an error code */ //退出} midx = getmaxx() / 2; //获得屏幕中点坐标,midy = getmaxy() / 2; //getmaxy() 获得屏幕像素点数的最大值setcolor(getmaxcolor()); //设置画笔颜色,//getmaxcolor()获得屏幕支持的最大颜色值/* draw the circle */ circle(midx, midy, radius); //以(midx, midy)为圆心,以 radius为半径画圆/* clean up */ getch(); closegraph(); //关闭图形系统return 0; }
2023-06-20 08:18:441

C语言库函数的相关概念

函数名:abort功 能:异常终止一个进程函数与形参类型:void abort(void);程序例:#include <stdio.h>#include <stdlib.h> int main(void){printf(Calling abort() );abort();return 0; /* This is never reached */} 函数名:abs功 能:计算整数num的值。返回整数num的绝对值函数与参数类型:int abs(num)int num;程序例:#include <stdio.h>#include <math.h> int main(void){int number = -1234; printf(number: %d absolute value: %d , number, abs(number));return 0;} 函数名: absread, abswirte功 能:绝对磁盘扇区读、写数据函数与形参类型:int absread(int drive, int nsects, int sectno, void *buffer);int abswrite(int drive, int nsects, in tsectno, void *buffer);程序例:/* absread example */ #include <stdio.h>#include <conio.h>#include <process.h>#include <dos.h> int main(void){int i, strt, ch_out, sector;char buf[512]; printf(Insert a diskette into drive A and press any key );getch();sector = 0;if (absread(0, 1, sector, &buf) != 0){perror(Disk problem);exit(1);}printf(Read OK );strt = 3;for (i=0; i<80; i++){ch_out = buf[strt+i];putchar(ch_out);}printf( );return(0);} 函数名:access功 能:确定文件的访问权限函数与形参类型:int access(const char *filename, int amode);程序例:#include <stdio.h>#include <io.h> int file_exists(char *filename); int main(void){printf(Does NOTEXIST.FIL exist: %s ,file_exists(NOTEXISTS.FIL) ? YES : NO);return 0;} int file_exists(char *filename){return (access(filename, 0) == 0);} 函数名: acos功 能:计算并返回arccos(x)值、要求-1<=X<=1函数与形参类型:double acos(x)double x;程序例:#include <stdio.h>#include <math.h> int main(void){double result;double x = 0.5; result = acos(x);printf(The arc cosine of %lf is %lf , x, result);return 0;} 函数名:allocmem功 能:分配DOS存储段函数与形参类型:int allocmem(unsigned size, unsigned *seg);程序例:#include <dos.h>#include <alloc.h>#include <stdio.h> int main(void){unsigned int size, segp;int stat; size = 64; /* (64 x 16) = 1024 bytes */stat = allocmem(size, &segp);if (stat == -1)printf(Allocated memory at segment: %x , segp);elseprintf(Failed: maximum number of paragraphs available is %u ,stat); return 0;} 函数名:arc功 能:画一弧线函数与形参类型:void far arc(int x, int y, int stangle, int endangle, int radius);程序例:#include <graphics.h>#include <stdlib.h>#include <stdio.h>#include <conio.h>int main(void){/* request auto detection */int gdriver = DETECT, gmode, errorcode;int midx, midy;int stangle = 45, endangle = 135;int radius = 100; /* initialize graphics and local variables */initgraph(&gdriver, &gmode, ); /* read result of initialization */errorcode = graphresult(); /* an error occurred */if (errorcode != grOk){printf(Graphics error: %s , grapherrormsg(errorcode));printf(Press any key to halt:);getch(); exit(1); /* terminate with an error code */} midx = getmaxx() / 2;midy = getmaxy() / 2;setcolor(getmaxcolor()); /* draw arc */arc(midx, midy, stangle, endangle, radius); /* clean up */getch();closegraph();return 0;} 函数名: asctime功 能:转换日期和时间为ASCII码函数与形参类型:char *asctime(const struct tm *tblock);程序例:#include <stdio.h>#include <string.h>#include <time.h> int main(void){struct tm t;char str[80]; /* sample loading of tm structure */ t. tm_sec = 1; /* Seconds */t. tm_min = 30; /* Minutes */t. tm_hour = 9; /* Hour */t. tm_mday = 22; /* Day of the Month */t. tm_mon = 11; /* Month */t. tm_year = 56; /* Year - does not include century */t. tm_wday = 4; /* Day of the week */t. tm_yday = 0; /* Does not show in asctime */t. tm_isdst = 0; /* Is Daylight SavTime; does not show in asctime */ /* converts structure to null terminatedstring */ strcpy(str, asctime(&t));printf(%s , str); return 0;} 函数名::asin功 能::计算并返回arcsin(x)值、要求-1<=X<=1函数与形参类型:double asin(x)double x;程序例:#include <stdio.h>#include <math.h> int main(void){double result;double x = 0.5; result = asin(x);printf(The arc sin of %lf is %lf , x, result);return(0);} 函数名: assert功 能:测试一个条件并可能使程序终止函数与形参类型:void assert(int test);程序例:#include <assert.h>#include <stdio.h>#include <stdlib.h> struct ITEM {int key;int value;}; /* add item to list, make sure list is not null */void additem(struct ITEM *itemptr) {assert(itemptr != NULL);/* add item to list */} int main(void){additem(NULL);return 0;} 函数名:atan功 能:计算并返回arctan(x)的值函数与形参类型:double atan(double x);程序例:#include <stdio.h>#include <math.h> int main(void){double result;double x = 0.5; result = atan(x);printf(The arc tangent of %lf is %lf , x, result);return(0);} 函数名: atan2功 能:计算并返回arctan(x/y)值函数与形参类型:double atan2(double y, double x);程序例:#include <stdio.h>#include <math.h> int main(void){double result;double x = 90.0, y = 45.0; result = atan2(y, x);printf(The arc tangent ratio of %lf is %lf , (y / x), result);return 0;} 函数名: atexit功 能:注册终止函数函数与形参类型:int atexit(atexit_t func);程序例:#include <stdio.h>#include <stdlib.h> void exit_fn1(void){printf(Exit function #1 called );} void exit_fn2(void){printf(Exit function #2 called );} int main(void){/* post exit function #1 */atexit(exit_fn1);/* post exit function #2 */atexit(exit_fn2);return 0;} 函数名: atof功 能:把str指向的ASCⅡ字符串转换成一个double型整数返回双精度的结果函数与形参类型:double atof(str)char*str;程序例:#include <stdlib.h>#include <stdio.h> int main(void){float f;char *str = 12345.67; f = atof(str);printf(string = %s float = %f , str, f);return 0;} 函数名:atoi功 能:把str指向的ASCⅡz字符串转换成一个整数。返回整数结果函数与参数类型:double atoi(str )char *str;程序例:#include <stdlib.h>#include <stdio.h> int main(void){int n;char *str = 12345.67; n = atoi(str);printf(string = %s integer = %d , str, n);return 0;} 函数名:atol功 能:把字符串转换成长整型数 。返回长整数结果函数与参数类型:long atol(str )char *str;程序例:#include <stdlib.h>#include <stdio.h> int main(void){long l;char *str = 98765432; l = atol(lstr);printf(string = %s integer = %ld , str, l);return(0);} 函数名:mkdir功 能:建立一个目录用 法:int mkdir(char *pathname);程序例:#include <stdio.h>#include <conio.h>#include <process.h>#include <dir.h>int main(void){int status;clrscr();status = mkdir(asdfjklm);(!status) ? (printf(Directory created )) :(printf(Unable to create directory ));getch();system(dir);getch();status = rmdir(asdfjklm);(!status) ? (printf(Directory deleted )) :(perror(Unable to delete directory));return 0;} 函数名: mktemp功 能:建立唯一的文件名用 法:char *mktemp(char *template);程序例:#include <dir.h>#include <stdio.h>int main(void){/* fname defines the template for thetemporary file. */char *fname = TXXXXXX, *ptr;ptr = mktemp(fname);printf(%s ,ptr);return 0;} 函数名: MK_FP功 能:设置一个远指针用 法:void far *MK_FP(unsigned seg, unsigned off);程序例:#include <dos.h>#include <graphics.h>int main(void){int gd, gm, i;unsigned int far *screen;detectgraph(&gd, &gm);if (gd == HERCMONO)screen = MK_FP(0xB000, 0);elsescreen = MK_FP(0xB800, 0);for (i=0; i<26; i++)screen[i] = 0x0700 + ("a" + i);return 0;} 函数名: modf功 能:把数分为整数和尾数用 法:double modf(double value, double *iptr);程序例:#include <math.h>#include <stdio.h>int main(void){double fraction, integer;double number = 100000.567;fraction = modf(number, &integer);printf(The whole and fractional parts of %lf are %lf and %lf ,number, integer, fraction);return 0;} 函数名: movedata功 能:拷贝字节用 法:void movedata(int segsrc, int offsrc, int segdest,int offdest, unsigned numbytes);程序例:#include <mem.h>#define MONO_BASE 0xB000/* saves the contents of the monochrome screen in buffer */void save_mono_screen(char near *buffer){movedata(MONO_BASE, 0, _DS, (unsigned)buffer, 80*25*2);}int main(void){char buf[80*25*2];save_mono_screen(buf);} 函数名: moverel功 能:将当前位置(CP)移动一相对距离用 法:void far moverel(int dx, int dy);程序例:#include <graphics.h>#include <stdlib.h>#include <stdio.h>#include <conio.h>int main(void){/* request auto detection */int gdriver = DETECT, gmode, errorcode;char msg[80];/* initialize graphics and local variables */initgraph(&gdriver, &gmode, );/* read result of initialization */errorcode = graphresult();if (errorcode != grOk) /* an error occurred */{printf(Graphics error: %s , grapherrormsg(errorcode));printf(Press any key to halt:);getch();exit(1); /* terminate with an error code */}/* move the C.P. to location (20, 30) */moveto(20, 30);/* plot a pixel at the C.P. */putpixel(getx(), gety(), getmaxcolor());/* create and output a message at (20, 30) */sprintf(msg, (%d, %d), getx(), gety());outtextxy(20, 30, msg);/* move to a point a relative distance *//* away from the current value of C.P. */moverel(100, 100);/* plot a pixel at the C.P. */putpixel(getx(), gety(), getmaxcolor());/* create and output a message at C.P. */sprintf(msg, (%d, %d), getx(), gety());outtext(msg);/* clean up */getch();closegraph();return 0;} 函数名: movetext功 能:将屏幕文本从一个矩形区域拷贝到另一个矩形区域用 法:int movetext(int left, int top, int right, int bottom,int newleft, int newtop);程序例:#include <conio.h>#include <string.h>int main(void){char *str = This is a test string;clrscr();cputs(str);getch();movetext(1, 1, strlen(str), 2, 10, 10);getch();return 0;} 函数名: moveto功 能:将CP移到(x, y)用 法:void far moveto(int x, int y);程序例:#include <graphics.h>#include <stdlib.h>#include <stdio.h>#include <conio.h>int main(void){/* request auto detection */int gdriver = DETECT, gmode, errorcode;char msg[80];/* initialize graphics and local variables */initgraph(&gdriver, &gmode, );/* read result of initialization */errorcode = graphresult();if (errorcode != grOk) /* an error occurred */{printf(Graphics error: %s , grapherrormsg(errorcode));printf(Press any key to halt:);getch();exit(1); /* terminate with an error code */}/* move the C.P. to location (20, 30) */moveto(20, 30);/* plot a pixel at the C.P. */putpixel(getx(), gety(), getmaxcolor());/* create and output a message at (20, 30) */sprintf(msg, (%d, %d), getx(), gety());outtextxy(20, 30, msg);/* move to (100, 100) */moveto(100, 100);/* plot a pixel at the C.P. */putpixel(getx(), gety(), getmaxcolor());/* create and output a message at C.P. */sprintf(msg, (%d, %d), getx(), gety());outtext(msg);/* clean up */getch();closegraph();return 0;} 函数名: movemem功 能:移动一块字节用 法:void movemem(void *source, void *destin, unsigned len);程序例:#include <mem.h>#include <alloc.h>#include <stdio.h>#include <string.h>int main(void){char *source = Borland International;char *destination;int length;length = strlen(source);destination = malloc(length + 1);movmem(source,destination,length);printf(%s ,destination);return 0;} 函数名: normvideo功 能:选择正常亮度字符用 法:void normvideo(void);程序例:#include <conio.h>int main(void){normvideo();cprintf(NORMAL Intensity Text );return 0;} 函数名: nosound功 能:关闭PC扬声器用 法:void nosound(void);程序例:/* Emits a 7-Hz tone for 10 seconds.Tru
2023-06-20 08:18:531

如何在CentOS 7上安装Elastic Stack

2023-06-20 08:19:061

OpenGrok 搜索用法

部署安装OpenGrok {O 之后需要使用—— 搜索引擎对比—— 23 Google Search Tips You"ll Want to Learn https://www.google.com/advanced_search https://www.google.com/advanced_image_search 搜索操作符支持,类似的google支持的 Search operators A Query is a series of clauses. A clause may be prefixed by: A clause may be either: Regular Expression, Wildcard, Fuzzy, Proximity & Range Searches:
2023-06-20 08:19:131

python的web开发框架有哪些

1、Django框架Django是一个开放源代码的Web 应用框架,由纯Python写成,是目前 Python 语言中主流 de 三大Web框架之一(flask、django、tornado),是最容易上手的框架。2、Flask框架flask框架是python中的一个轻量级的前后端开发框架,不同于Django,flask只提供基础的功能,其他的功能需要安装各种插件。因为轻量,所以可以用来做一些小工程和低流量的开发;大型工程也可以使用flask框架,但是就需要安装很多插件。3、Pyramind框架Pyramind是一个扩展性很强且灵活的 Python Web 开发框架。上手十分容易,比较适合中等规模且边开发边设计的场景。Pyramid 不提供绝对严格的框架定义,根据需求可以扩展开发,对高阶程序员十分友好。4、web.py框架web.py 是一个Python 的web框架,它简单而且功能强大。web.py 是公开的,无论用于什么用途都是没有限制的。而且相当的小巧,应当归属于轻量级的web 框架。但这并不影响web.py 的强大,而且使用起来很简单、很直接。5、Tornado框架Tornado是一个Python web框架和异步网络库,最初是在FriendFeed开发的。通过使用非阻塞网络I/O, Tornado可以扩展到数以万计的开放连接,非常适合长轮询、WebSockets和其他需要与每个用户进行长时间连接的应用程序。6、TurboGears框架TurboGears具有其他Python框架都具有的功能,但与其他框架一样没有限制,因此可以说是框架的终结者。也可以应用于简单的微体系结构项目。它感觉不像在框架中工作,而是写新的功能。7、CherryPy框架CherryPy是一个轻量级的python网络框架,用来创建网络应用。比如快速实现api接口、做网站后端这样。感觉和flask差不多。8、Flcon框架Falcon是一个最低限度的ASGI/WSGI框架,用于构建任务关键型REST API和微服务,重点关注规模上的可靠性、正确性和性能。9、Asgineer框架Asgineer是一种编写异步Web应用程序的工具,使用尽可能少的抽象,同时仍然提供友好的API。10、Bottle框架Bottle是一个用于Python的快速、简单和轻量级的WSGI微型网络框架。它作为单个文件模块分发,除了Python标准库之外没有任何依赖项。
2023-06-20 08:19:232

C语言中的俄罗斯方块

望采纳!!#i nclude <stdio.h>#i nclude <dos.h>#i nclude <conio.h>#i nclude <graphics.h>#i nclude <stdlib.h> #ifdef __cplusplus #define __CPPARGS ...#else#define __CPPARGS#endif#define MINBOXSIZE 15 /* 最小方块的尺寸 */#define BGCOLOR 7 /* 背景着色 */#define GX 200#define GY 10#define SJNUM 10000 /* 每当玩家打到一万分等级加一级*//* 按键码*/#define VK_LEFT 0x4b00#define VK_RIGHT 0x4d00#define VK_DOWN 0x5000#define VK_UP 0x4800#define VK_HOME 0x4700#define VK_END 0x4f00#define VK_SPACE 0x3920#define VK_ESC 0x011b#define VK_ENTER 0x1c0d/* 定义俄罗斯方块的方向(我定义他为4种)*/#define F_DONG 0#define F_NAN 1#define F_XI 2#define F_BEI 3#define NEXTCOL 20 /* 要出的下一个方块的纵坐标*/#define NEXTROW 12 /* 要出的下一个方块的横从标*/#define MAXROW 14 /* 游戏屏幕大小*/#define MAXCOL 20#define SCCOL 100 /*游戏屏幕大显示器上的相对位置*/#define SCROW 60int gril[22][16]; /* 游戏屏幕坐标*/int col=1,row=7; /* 当前方块的横纵坐标*/int boxfx=0,boxgs=0; /* 当前寺块的形壮和方向*/int nextboxfx=0,nextboxgs=0,maxcol=22;/*下一个方块的形壮和方向*/int minboxcolor=6,nextminboxcolor=6;int num=0; /*游戏分*/int dj=0,gamedj[10]={18,16,14,12,10,8,6,4,2,1};/* 游戏等级*//* 以下我用了一个3维数组来纪录方块的最初形状和方向*/int boxstr[7][4][16]={{{1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0},{0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0},{1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0},{0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0}},{{0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0},{1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0},{0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0},{1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0}},{{1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0},{1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0},{1,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0},{0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0}},{{1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0},{1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0},{0,1,0,0,0,1,0,0,1,1,0,0,0,0,0,0},{1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0}},{{0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0},{0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0},{0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0},{0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0}},{{1,1,0,0,1,1,0,0,0,0,0,0.0,0,0,0},{1,1,0,0,1,1,0,0,0,0,0,0.0,0,0,0},{1,1,0,0,1,1,0,0,0,0,0,0.0,0,0,0},{1,1,0,0,1,1,0,0,0,0,0,0.0,0,0,0}},{{0,0,0,0,1,1,1,0,0,1,0,0,0,0,0,0},{1,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0},{0,1,0,0,1,1,1,0,0,0,0,0.0,0,0,0},{0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0}}};/* 随机得到当前方块和下一个方块的形状和方向*/void boxrad(){minboxcolor=nextminboxcolor;boxgs=nextboxgs;boxfx=nextboxfx;nextminboxcolor=random(14)+1;if(nextminboxcolor==4||nextminboxcolor==7||nextminboxcolor==8)nextminboxcolor=9;nextboxfx=F_DONG;nextboxgs=random(7);}/*初始化图形模试*/void init(int gdrive,int gmode){int errorcode;initgraph(&gdrive,&gmode,"e: c");errorcode=graphresult();if(errorcode!=grOk){printf("error of: %s",grapherrormsg(errorcode));exit(1);}}/* 在图形模式下的清屏 */void cls(){setfillstyle(SOLID_FILL,0);setcolor(0);bar(0,0,640,480);}/*在图形模式下的高级清屏*/void clscr(int a,int b,int c,int d,int color){setfillstyle(SOLID_FILL,color);setcolor(color);bar(a,b,c,d);}/*最小方块的绘制*/void minbox(int asc,int bsc,int color,int bdcolor){int a=0,b=0;a=SCCOL+asc;b=SCROW+bsc;clscr(a+1,b+1,a-1+MINBOXSIZE,b-1+MINBOXSIZE,color);if(color!=BGCOLOR){setcolor(bdcolor);line(a+1,b+1,a-1+MINBOXSIZE,b+1);line(a+1,b+1,a+1,b-1+MINBOXSIZE);line(a-1+MINBOXSIZE,b+1,a-1+MINBOXSIZE,b-1+MINBOXSIZE);line(a+1,b-1+MINBOXSIZE,a-1+MINBOXSIZE,b-1+MINBOXSIZE);}}/*游戏中出现的文字*/void txt(int a,int b,char *txt,int font,int color){setcolor(color);settextstyle(0,0,font);outtextxy(a,b,txt);}/*windows 绘制*/void win(int a,int b,int c,int d,int bgcolor,int bordercolor){clscr(a,b,c,d,bgcolor);setcolor(bordercolor);line(a,b,c,b);line(a,b,a,d);line(a,d,c,d);line(c,b,c,d);}/* 当前方块的绘制*/void funbox(int a,int b,int color,int bdcolor){int i,j;int boxz[4][4];for(i=0;i<16;i++)boxz[i/4][i%4]=boxstr[boxgs][boxfx][i];for(i=0;i<4;i++)for(j=0;j<4;j++)if(boxz[i][j]==1)minbox((j+row+a)*MINBOXSIZE,(i+col+b)*MINBOXSIZE,color,bdcolor);}/*下一个方块的绘制*/void nextfunbox(int a,int b,int color,int bdcolor){int i,j;int boxz[4][4];for(i=0;i<16;i++)boxz[i/4][i%4]=boxstr[nextboxgs][nextboxfx][i];for(i=0;i<4;i++)for(j=0;j<4;j++)if(boxz[i][j]==1)minbox((j+a)*MINBOXSIZE,(i+b)*MINBOXSIZE,color,bdcolor);}/*时间中断定义*/#define TIMER 0x1cint TimerCounter=0;void interrupt ( *oldhandler)(__CPPARGS);void interrupt newhandler(__CPPARGS){TimerCounter++;oldhandler();}void SetTimer(void interrupt (*IntProc)(__CPPARGS)){oldhandler=getvect(TIMER);disable();setvect(TIMER,IntProc);enable();}/*由于游戏的规则,消掉都有最小方块的一行*/void delcol(int a){int i,j;for(i=a;i>1;i--)for(j=1;j<15;j++){minbox(j*MINBOXSIZE,i*MINBOXSIZE,BGCOLOR,BGCOLOR);gril[i][j]=gril[i-1][j];if(gril[i][j]==1)minbox(j*MINBOXSIZE,i*MINBOXSIZE,minboxcolor,0);}}/*消掉所有都有最小方块的行*/void delete(){int i,j,zero,delgx=0;char *nm="00000";for(i=1;i<21;i++){zero=0;for(j=1;j<15;j++)if(gril[i][j]==0)zero=1;if(zero==0){delcol(i);delgx++;}}num=num+delgx*delgx*10;dj=num/10000;sprintf(nm,"%d",num);clscr(456,173,500,200,4);txt(456,173,"Number:",1,15);txt(456,193,nm,1,15);}/*时间中断结束*/void KillTimer(){disable();setvect(TIMER,oldhandler);enable();}/* 测试当前方块是否可以向下落*/int downok(){int i,j,k=1,a[4][4];for(i=0;i<16;i++)a[i/4][i%4]=boxstr[boxgs][boxfx][i];for(i=0;i<4;i++)for(j=0;j<4;j++)if(a[i][j] && gril[col+i+1][row+j])k=0;return(k);}/* 测试当前方块是否可以向左行*/int leftok(){int i,j,k=1,a[4][4];for(i=0;i<16;i++)a[i/4][i%4]=boxstr[boxgs][boxfx][i];for(i=0;i<4;i++)for(j=0;j<4;j++)if(a[i][j] && gril[col+i][row+j-1])k=0;return(k);}/* 测试当前方块是否可以向右行*/int rightok(){int i,j,k=1,a[4][4];for(i=0;i<16;i++)a[i/4][i%4]=boxstr[boxgs][boxfx][i];for(i=0;i<4;i++)for(j=0;j<4;j++)if(a[i][j] && gril[col+i][row+j+1])k=0;return(k);}/* 测试当前方块是否可以变形*/int upok(){int i,j,k=1,a[4][4];for(i=0;i<4;i++)for(i=0;i<16;i++)a[i/4][i%4]=boxstr[boxgs][boxfx+1][i];for(i=3;i>=0;i--)for(j=3;j>=0;j--)if(a[i][j] && gril[col+i][row+j])k=0;return(k);}/*当前方块落下之后,给屏幕坐标作标记*/void setgril(){int i,j,a[4][4];funbox(0,0,minboxcolor,0);for(i=0;i<16;i++)a[i/4][i%4]=boxstr[boxgs][boxfx][i];for(i=0;i<4;i++)for(j=0;j<4;j++)if(a[i][j])gril[col+i][row+j]=1;col=1;row=7;}/*游戏结束*/void gameover(){int i,j;for(i=20;i>0;i--)for(j=1;j<15;j++)minbox(j*MINBOXSIZE,i*MINBOXSIZE,2,0);txt(103,203,"Game Over",3,10);}/*按键的设置*/void call_key(int keyx){switch(keyx){case VK_DOWN: { /*下方向键,横坐标加一。*/if(downok()){col++;funbox(0,0,minboxcolor,0);}else{funbox(0,0,minboxcolor,0);setgril();nextfunbox(NEXTCOL,NEXTROW,4,4);boxrad();nextfunbox(NEXTCOL,NEXTROW,nextminboxcolor,0);delete();}break;}case VK_UP: { /*上方向键,方向形状旋转90度*/if(upok())boxfx++;if(boxfx>3)boxfx=0;funbox(0,0,minboxcolor,0);break;}case VK_LEFT:{ /*左方向键,纵坐标减一*/if(leftok())row--;funbox(0,0,minboxcolor,0);break;}case VK_RIGHT:{ /*右方向键,纵坐标加一*/if(rightok())row++;funbox(0,0,minboxcolor,0);break;}case VK_SPACE: /*空格键,直接落到最后可以落到的们置*/while(downok())col++;funbox(0,0,minboxcolor,0);setgril();nextfunbox(NEXTCOL,NEXTROW,4,4);boxrad();nextfunbox(NEXTCOL,NEXTROW,nextminboxcolor,0);delete();break;default:{txt(423,53,"worng key!",1,4);txt(428,80,"Plese Enter Anly Key AG!",1,4);getch();clscr(420,50,622,97,BGCOLOR);}}}/*时间中断开始*/void timezd(void){int key;SetTimer(newhandler);boxrad();nextfunbox(NEXTCOL,NEXTROW,nextminboxcolor,0);for(;;){if(bioskey(1)){key=bioskey(0);funbox(0,0,BGCOLOR,BGCOLOR);if(key==VK_ESC)break;call_key(key);}if(TimerCounter>gamedj[dj]){TimerCounter=0;if(downok()){funbox(0,0,BGCOLOR,BGCOLOR);col++;funbox(0,0,minboxcolor,0);}else {if(col==1){gameover();getch();break;}setgril();delete();funbox(0,0,minboxcolor,0);col=1;row=7;funbox(0,0,BGCOLOR,BGCOLOR);nextfunbox(NEXTCOL,NEXTROW,4,4);boxrad();nextfunbox(NEXTCOL,NEXTROW,nextminboxcolor,0);}}}}/*主程序开始*/void main(void){int i,j;char *nm="00000";init(VGA,VGAHI);cls();/*屏幕坐标初始化*/for(i=0;i<=MAXCOL+1;i++)for(j=0;j<=MAXROW+1;j++)gril[i][j]=0;for(i=0;i<=MAXCOL+1;i++) {gril[i][0]=1;gril[i][15]=1;}for(j=1;j<=MAXROW;j++){gril[0][j]=1;gril[21][j]=1;}clscr(0,0,640,480,15);win(1,1,639,479,4,15);win(SCCOL+MINBOXSIZE-2,SCROW+MINBOXSIZE-2,SCCOL+15*MINBOXSIZE+2,SCROW+21*MINBOXSIZE+2,BGCOLOR,0);nextboxgs=random(8);nextboxfx=random(4);sprintf(nm,"%d",num);txt(456,173,"Number:",1,15);txt(456,193,nm,1,15);txt(456,243,"Next Box:",1,15);timezd();KillTimer();closegraph();}
2023-06-20 08:19:331

fillpoly在c语言中什么意思

函数名: fillpoly 功 能: 画并填充一个多边形 用 法: void far fillpoly(int numpoints, int far *polypoints); int numpoints:多边形边数 int far *polypoints:存储各顶点坐标的数组,每两个一组表示一个顶点的X,Y坐标 程序例: #include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int i, maxx, maxy; /* our polygon array */ int poly[8]; /* initialize graphics, local variables */ initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ { printf("Graphics error: %s ", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* terminate with an error code */ } maxx = getmaxx(); maxy = getmaxy(); poly[0] = 20; /* 1st vertext */ poly[1] = maxy / 2; poly[2] = maxx - 20; /* 2nd */ poly[3] = 20; poly[4] = maxx - 50; /* 3rd */ poly[5] = maxy - 20; /* 4th vertex. fillpoly automatically closes the polygon. */ poly[6] = maxx / 2; poly[7] = maxy / 2; /* loop through the fill patterns */ for (i=EMPTY_FILL; i<USER_FILL; i++) { /* set fill pattern */ setfillstyle(i, getmaxcolor()); /* draw a filled polygon */ fillpoly(4, poly); getch(); } /* clean up */ closegraph(); return 0; }
2023-06-20 08:19:421

Logstash 五种替代方案(Filebeat、Fluentd、rsyslog、syslog-ng 以及 Logagent

优势 Logstash 主要的有点就是它的灵活性,这还主要因为它有很多插件。然后它清楚的文档已经直白的配置格式让它可以再多种场景下应用。这样的良性循环让我们可以在网上找到很多资源,几乎可以处理任何问题。以下是一些例子: 5 minute intro reindexing data in Elasticsearch parsing Elasticsearch logs rewriting Elasticsearch slowlogs so you can replay them with JMeter 劣势 Logstash 致命的问题是它的性能以及资源消耗(默认的堆大小是 1GB)。尽管它的性能在近几年已经有很大提升,与它的替代者们相比还是要慢很多的。这里有 Logstash 与 rsyslog 性能对比 以及 Logstash 与 filebeat 的性能对比 。它在大数据量的情况下会是个问题。 优势 Filebeat 只是一个二进制文件没有任何依赖。它占用资源极少,尽管它还十分年轻,正式因为它简单,所以几乎没有什么可以出错的地方,所以它的可靠性还是很高的。它也为我们提供了很多可以调节的点,例如:它以何种方式搜索新的文件,以及当文件有一段时间没有发生变化时,何时选择关闭文件句柄。 劣势 Filebeat 的应用范围十分有限,所以在某些场景下我们会碰到问题。例如,如果使用 Logstash 作为下游管道,我们同样会遇到性能问题。正因为如此,Filebeat 的范围在扩大。开始时,它只能将日志发送到 Logstash 和 Elasticsearch,而现在它可以将日志发送给 Kafka 和 Redis,在 5.x 版本中,它还具备过滤的能力。 典型应用场景 Filebeat 在解决某些特定的问题时:日志存于文件,我们希望 将日志直接传输存储到 Elasticsearch 。这仅在我们只是抓去(grep)它们或者日志是存于 JSON 格式(Filebeat 可以解析 JSON)。或者如果打算使用 Elasticsearch 的 Ingest 功能对日志进行解析和丰富。 将日志发送到 Kafka/Redis 。所以另外一个传输工具(例如,Logstash 或自定义的 Kafka 消费者)可以进一步丰富和转发。这里假设选择的下游传输工具能够满足我们对功能和性能的要求 优势 可以获取 /var/log 下的所有信息,解析各种格式(Elasticsearch,Solr,MongoDB,Apache HTTPD等等),它可以掩盖敏感的数据信息,例如,个人验证信息(PII),出生年月日,信用卡号码,等等。它还可以基于 IP 做 GeoIP 丰富地理位置信息(例如,access logs)。同样,它轻量又快速,可以将其置入任何日志块中。在新的 2.0 版本中,它以第三方 node.js 模块化方式增加了支持对输入输出的处理插件。重要的是 Logagent 有本地缓冲,所以不像 Logstash ,在数据传输目的地不可用时会丢失日志。 劣势 尽管 Logagent 有些比较有意思的功能(例如,接收 Heroku 或 CloudFoundry 日志),但是它并没有 Logstash 灵活。 典型应用场景 Logagent 作为一个可以做所有事情的传输工具是值得选择的(提取、解析、缓冲和传输)。 优势 rsyslog 是经测试过的最快的传输工具。如果只是将它作为一个简单的 router/shipper 使用,几乎所有的机器都会受带宽的限制,但是它非常擅长处理解析多个规则。它基于语法的模块( mmnormalize )无论规则数目如何增加,它的处理速度始终是 线性增长 的。这也就意味着,如果当规则在 20-30 条时,如解析 Cisco 日志时,它的性能可以大大超过基于正则式解析的 grok ,达到 100 倍(当然,这也取决于 grok 的实现以及 liblognorm 的版本)。 它同时也是我们能找到的最轻的解析器,当然这也取决于我们配置的缓冲。 劣势 rsyslog 的配置工作需要更大的代价(这里有一些 例子 ),这让两件事情非常困难: 文档 难以搜索和阅读,特别是那些对术语比较陌生的开发者。 5.x 以上的版本格式不太一样(它扩展了 syslogd 的配置格式,同时也仍然支持旧的格式),尽管新的格式可以兼容旧格式,但是新的特性(例如,Elasticsearch 的输出)只在新的配置下才有效,然后旧的插件(例如,Postgres 输出)只在旧格式下支持。 尽管在配置稳定的情况下,rsyslog 是可靠的(它自身也提供多种配置方式,最终都可以获得相同的结果),它还是存在一些 bug 。 可以将 syslog-ng 当作 rsyslog 的替代品(尽管历史上它们是两种不同的方式)。它也是一个模块化的 syslog 守护进程,但是它可以做的事情要比 syslog 多。它可以接收磁盘缓冲并将 Elasticsearch HTTP 作为输出。它使用 PatternDB 作为语法解析的基础,作为 Elasticsearch 的传输工具,它是一个不错的选择。 优势 和 rsyslog 一样,作为一个轻量级的传输工具,它的性能也非常好。它曾经比 rsyslog 慢很多,但是 2 年前能达到 570K Logs/s 的性能 并不差。并不像 rsyslog ,它有着明确一致的配置格式以及完好的文档。 劣势 Linux 发布版本转向使用 rsyslog 的原因是 syslog-ng 高级版曾经有很多功能在开源版中都存在,但是后来又有所限制。我们这里只关注与开源版本,所有的日志传输工具都是开源的。现在又有所变化,例如磁盘缓冲,曾经是高级版存在的特性,现在开源版也有。但有些特性,例如带有应用层的通知的可靠传输协议(reliable delivery protocol)还没有在开源版本中。
2023-06-20 08:19:491

墨尔本大学COMP30026 Models of Computation 课程辅导?

墨尔本大学COMP30026 Models of Computation 课程辅导可以的。课程介绍:形式逻辑和离散数学为计算机科学提供了理论基础。 本课程使用逻辑和离散数学来模拟计算科学。 它为逻辑,集合,关系,函数,自动机,形式语言和可计算性理论提供了基础,提供了几乎所有该学科贡献的实用工具的概念,用于数据的自动存储,检索,操作和通信。作业形式:2篇文章作业,在线平台(Grok)练习作业,期末考试作业信息:取自2020年第一学期占比12%:一份800-1000字的文章作业,Week 7左右提交。占比12%:一份800-1000字的文章作业,Week 12左右提交。占比6%:成功完成Grok平台的至少75%练习。占比70%:期末考试。
2023-06-20 08:19:561

虚空鳐+虚空龙详细任务清单

很烦很多..................................
2023-06-20 08:20:058

使用Filebeat采集日志结合logstash过滤出你想要的日志

使用外国大佬的开源项目,基本不要改什么就可快速搭建一套单机版ELK用于练手。 注意 :logstash已被我改造,如果以该项目构建ELK记得更改logstash.conf。 ELK项目github链接: https://github.com/deviantony/docker-elk 这里对es不做过多描述,主要针对filebeat和logstash讲解。 Filebeat是一个轻量级的托运人,用于转发和集中日志数据。Filebeat作为代理安装在服务器上,监视您指定的日志文件或位置,收集日志事件,并将它们转发到Elasticsearch或 Logstash进行索引。 Filebeat的工作原理:启动Filebeat时,它会启动一个或多个输入,这些输入将查找您为日志数据指定的位置。对于Filebeat找到的每个日志,Filebeat启动一个收集器。每个收集器为新内容读取单个日志,并将新日志数据发送到libbeat,libbeat聚合事件并将聚合数据发送到您为Filebeat配置的输出。 官方流程图如下: Logstash是一个具有实时流水线功能的开源数据收集引擎。Logstash可以动态统一来自不同来源的数据,并将数据标准化为您选择的目的地。为各种高级下游分析和可视化用例清理和民主化所有数据。 Logstash的优势: 接着进入正文,先讲下我的需求。 ELK以搭好,由elasticsearch+logstash+kibana 组成, 本文的filebeat作用是采集特定目录下的日志,并将其发送出去,但是它只能采集并无法对数据进行筛选,这时候就用到logstash了,logstash拥有众多插件可提供过滤筛选功能,由于logstash本身是基于jdk的,所以占用内存较大,而filebeat相较下,占用的内存就不是很多了。有图有真相: 所以可采用如下的方案采集筛选日志: 参考配置,只列出我用到的,详情见官方文档: 注:6.0以上该filebeat.yml需要挂载到/usr/share/filebeat/filebeat.yml,另外还需要挂载/usr/share/filebeat/data/registry 文件,避免filebeat容器挂了后,新起的重复收集日志。 我用到的logstash并不是用来采集日志的,而是对日志进行匹配筛选,所以不要跟随项目启动,只需单独启动,暴露5044端口,能接收到filebeat发送日志即可,也就是说,它只是起到一个加工并转发给elasticsearch的作用而已。 配置参考: 备注: 上面我自定义的格式是: 测试项目以上传到github 地址: https://github.com/liaozihong/ELK-CollectionLogs 参考链接: ELK 之Filebeat 结合Logstash Grok Debugger ELK logstash 配置语法(24th) Filebeat官方文档 Logstash官方文档
2023-06-20 08:20:311

c语言 函数名: bar3d 怎么用?

函数名: bar3d画一个三维条形图 void far bar3d(int left, int top, int right, int bottom, int depth, int topflag);程序例:#include <graphics.h>#include <stdlib.h>#include <stdio.h>#include <conio.h>int main(void){ /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int midx, midy, i; /* initialize graphics, local variables */ initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ { printf("Graphics error: %s ", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* terminate with error code */ } midx = getmaxx() / 2; midy = getmaxy() / 2; /* loop through the fill patterns */ for (i=EMPTY_FILL; i<USER_FILL; i++) { /* set the fill style */ setfillstyle(i, getmaxcolor()); /* draw the 3-d bar */ bar3d(midx-50, midy-50, midx+50, midy+50, 10, 1); getch(); } /* clean up */ closegraph(); return 0;}
2023-06-20 08:20:413

高分征求有详细注解的俄罗斯方块C语言源代码。

网上随便都有
2023-06-20 08:20:577

人文学院有哪些专业

不同高校的人文学院,专业也不同。有汉语言、汉语言文学、历史专业、有些学校会把新闻学、广告学也纳入其中。人文学院:   国语国文系、中语中文系、英语英文系、法语法文系、德语德文系、西语西文系、语言系、国史系、东洋史学系、考古美术系、哲学系、宗教系、美学系人文学院设文秘、新闻采编与制作、法律事务、商务英语、应用英语、英语教育、语文教育、数学教育等八个专业,
2023-06-20 08:21:213

C++游戏代码

#include<iostream.h>#include<windows.h>#include<time.h>#include<stdlib.h>#include<conio.h>#define N 21void gotoxy(int x,int y)//位置函数{COORD pos;pos.X=2*x;pos.Y=y;SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);}void color(int a)//颜色函数{SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);}void init(int apple[2])//初始化函数(初始化围墙、显示信息、苹果){int i,j;//初始化围墙int wall[N+2][N+2]={{0}};for(i=1;i<=N;i++){for(j=1;j<=N;j++)wall[i][j]=1;}color(11);for(i=0;i<N+2;i++){for(j=0;j<N+2;j++){if(wall[i][j])cout<<"∷";else cout<<"□";}cout<<endl;}gotoxy(N+3,1);//显示信息color(12);cout<<"按 ↑ ← ↓→ 移动方向"<<endl;gotoxy(N+3,2);color(12);cout<<"按任意键暂停"<<endl;gotoxy(N+3,3);color(12);cout<<"得分:"<<endl;apple[0]=rand()%N+1;//苹果apple[1]=rand()%N+1;gotoxy(apple[0],apple[1]);color(12);cout<<"㊣"<<endl;}int main(){int i,j;int** snake=NULL;int apple[2];int score=0;int tail[2];int len=3;char ch="p";srand((unsigned)time(NULL));init(apple);snake=(int**)realloc(snake,sizeof(int*)*len);for(i=0;i<len;i++)snake[i]=(int*)malloc(sizeof(int)*2);for(i=0;i<len;i++){snake[i][0]=N/2;snake[i][1]=N/2+i;gotoxy(snake[i][0],snake[i][1]);color(12);cout<<"㊣"<<endl;}while(1)//进入消息循环{tail[0]=snake[len-1][0];tail[1]=snake[len-1][1];gotoxy(tail[0],tail[1]);color(11);cout<<"∷"<<endl;for(i=len-1;i>0;i--){snake[i][0]=snake[i-1][0];snake[i][1]=snake[i-1][1];gotoxy(snake[i][0],snake[i][1]);color(14);cout<<"※"<<endl;}if(kbhit()){gotoxy(0,N+2);ch=getche();}switch(ch){case "w":snake[0][1]--;break;case "s":snake[0][1]++;break;case "a":snake[0][0]--;break;case "d":snake[0][0]++;break;default: break;}gotoxy(snake[0][0],snake[0][1]);color(14);cout<<"⊙"<<endl;Sleep(abs(200-0.5*score));if(snake[0][0]==apple[0]&&snake[0][1]==apple[1])//吃掉苹果后蛇分数加1,蛇长加1{score++;len++;snake=(int**)realloc(snake,sizeof(int*)*len);snake[len-1]=(int*)malloc(sizeof(int)*2);apple[0]=rand()%N+1;apple[1]=rand()%N+1;gotoxy(apple[0],apple[1]);color(12);cout<<"㊣"<<endl;gotoxy(N+5,4);color(12);cout<<score<<endl;}if(snake[0][1]==0||snake[0][0]==N||snake[0][1]==0||snake[0][1]==N)//撞到围墙后失败{gotoxy(N/2,N/2);color(3);cout<<"失败!!!"<<endl;for(i=0;i<len;i++)free(snake[i]);Sleep(INFINITE);exit(0);return 0;}}return 0;}贪吃蛇
2023-06-20 08:21:362

logstash好用不

总体来说,logsrash还行
2023-06-20 08:21:4511

C语言编程 绘制曲线,会的来

TC下调试通过/******************************************************* *Author :Wacs5 *Date :20090105(YYYY-MM-DD) *Function :画简易的曲线图 *********************************************************/#include <stdio.h>#include <conio.h>#include <stdlib.h>#include <math.h>#include <Graphics.h>#define n 8int main(){ int i,j; float data[]={7,3,12,6,9,5,8,11}; char str[40]; int gdrive=DETECT,gmode,errorcode; int maxx,maxy; int perx,pery; int x0,x1,y0,y1; int coloraxis=2,colorline=3; float mindata,maxdata,ndata; initgraph(&gdrive,&gmode,""); /*初始化设备*/ if ((errorcode=graphresult())!=grOk) /*查错*/ { printf("Graphics error:%s Press any key to exit:",grapherrormsg(errorcode)); getch(); exit(1); } maxx=getmaxx(); maxy=getmaxy(); mindata=maxdata=data[0]; for (i=1;i<n;i++) { if (mindata>data[i]) mindata=data[i]; if (maxdata<data[i]) maxdata=data[i]; } mindata=floor(mindata); maxdata=ceil(maxdata); perx=maxx/(n+4); pery=maxy/(maxdata-mindata+4); x0=2*perx; y0=maxy-2*pery; x1=maxx-2*perx; y1=2*pery; setcolor(coloraxis); line(x0,y0,x1,y0); line(x0,y0,x0,y1); line(x1,y0,x1-4,y0+3); line(x1,y0,x1-4,y0-3); line(x0,y1,x0+3,y1+4); line(x0,y1,x0-3,y1+4); settextjustify(CENTER_TEXT,TOP_TEXT); for (i=0;i<n;i+=n/3) { j=x0+i*perx; line(j,y0,j,y0+2); /*刻度线*/ sprintf(str,"%d",i); outtextxy(j,y0+4,str); } settextjustify(RIGHT_TEXT,CENTER_TEXT); for (i=(maxdata-mindata)/3;i<=maxdata-mindata;i+=(maxdata-mindata)/3) { j=y0-i*pery; line(x0,j,x0-2,j); /*刻度线*/ sprintf(str,"%d",(int)mindata+i); outtextxy(x0-4,j,str); } setcolor(colorline); x1=x0+perx; y1=y0-(data[0]-mindata)*pery; circle(x1,y1,2); moveto(x1,y1); i=1; do { x1+=perx; y1=y0-(data[i]-mindata)*pery; lineto(x1,y1); circle(x1,y1,2); moveto(x1,y1); i++; }while(i<n); getch(); closegraph(); return 0;}
2023-06-20 08:22:221

什么是”入声“,入声字怎样读?什么方言还保留入声?

入声是舌阻音,用舌尖轻抵上颚(揤qit7 七qit8)、下额(六liuk7)或者合唇阻断气流(十shep7 湿shep8)。在《广韵》中开合口音中归为合口音。入声在明代还保留,四川话承袭明代官话,比如脚读成jiok8,角读成grok5。到了清代,由于满语不分阴阳,基本没有入声,再加上雍正年间的正音运动,使得北方话失去阳音(短音)、去声(阴阳)合一(普通话四声)。不过北方话也残留了阳去(爸爸ba4ba5.-阴去阳去)、阳平(nai3nai6.-阴上阳平)二音。从东北话和宝鸡话可以推断,在清朝初年北方方言还保留中古汉语的发音,比如东北话的 鹅-ngo2,街grai1,宝鸡话 搿gop。而清朝的正音活动,使得北方只残留了少数入声方言片区,如晋方言。南方方言基本上保留了入声,比如接近唐宋音的粤语和潮汕话,接近南朝汉音的赣方言和客家话,衣冠南渡时形成的闽南语保留完整,明代洪武正音的江淮官话和西南官话保留了一部分。另外,越南语和韩语可以看成是唐宋官话留存。
2023-06-20 08:22:313

c语言,求输出一个圆的图形的程序

画圆的例子参考一下#include <graphics.h>#include <stdlib.h>#include <stdio.h>#include <conio.h>int main(void){/* request auto detection */int gdriver = DETECT, gmode, errorcode;int midx, midy;int radius = 100;/* initialize graphics and local variables */initgraph(&gdriver, &gmode, "");/* read result of initialization */errorcode = graphresult();if (errorcode != grOk) /* an error occurred */{printf("Graphics error: %s ", grapherrormsg(errorcode));printf("Press any key to halt:");getch();exit(1); /* terminate with an error code */}midx = getmaxx() / 2;midy = getmaxy() / 2;setcolor(getmaxcolor());/* draw the circle */circle(midx, midy, radius);/* clean up */getch();closegraph();return 0;}
2023-06-20 08:22:592

优先级调度算法如何用JAVA实现

在多线程时,可以手动去设置每个线程的优先级setPriority(int newPriority) 更改线程的优先级。
2023-06-20 08:23:092

趴着求英雄无敌5 1.3版的控制台代码

  add_army 1 1  中间不用加括号,就能加兵了,城镇代码  0 圣堂  1 森林  2 学院  3 地牢  4 亡灵  5 地狱  6 堡垒 (命运之锤和东方部落版本才有)  8 据点 (东方部落版本才有)  add_army 1 0 中的0之说明  0为未升级兵种 1为升级兵种 2为兵种第二种升级形态(东方部落才有第二种升级形态)  加移动点数  @ChangeHeroStat("英雄名字",7, 任意数字)  赛勒斯 Cyrus  埃莉娜 Eruina  法伊兹 Faiz  基特拉 Kythra  加利布 Galib  莱托兹 Lethos  哈韦兹 Havez  雷拉格 Raelag  霍拉 Jhora  赛格雷夫 Segref  马希尔 Maahir  莎蒂娅 Shadya  纳克西斯 Narxes  塞纳特 Sinitar  纳西尔 Nathir  索戈尔 Sorgal  努尔 Nur  维尚 Vayshan  拉扎克 Razzak  伊蓓丝 Yrbeth  泰莫克汉 Temkhan  宇尔沃娜 Yrwanna  泽希尔 Zehir  埃莉娜 Eruina  伊拉娅 Ylaya  斯拉塞 Thralsai  阿格贝斯 Agbeth  兰勒斯 Ranleth  杜戈尔 Dougal  阿格雷尔 Agrael  埃兰妮 Ellaine  阿莱斯特 Alastor  法蕾妲 Freyda  拜娅拉 Biara  迪里布 Deleb  伊雷吉尔 Erasial  哥德里克 Godric  格劳尔 Grawl  艾莲娜 Irina  格洛克 Grok  伊莎贝尔 Isabel  克劳斯 Klaus  耶泽蓓丝 Jezebeth  拉兹罗 Laszlo  马巴斯 Marbas  玫芙 Maeve  内比罗斯 Nebiros  尼科莱 Nicolai  奈穆斯 Nymus  拉特格 Rutger  魔王 Sovereign  维托里奥 Vittorio  维亚尔 Veyer  阿拉瑞克 Alaric  奥兰多 Orlando  拜亚拉Biara  圣·伊莎贝尔 Saint Isabel  邓肯 Duncan  法蕾妲 Freyda  伊莎贝尔 Isabel  拉兹罗 Laszlo  欧尼拉 Ornella  罗伦佐 Lorenzo  维拉利亚 Valeria  埃拉里克 Alaric  贝纳迪克特 Benedikt  伯阐德 Bertrand  加布里埃尔依 Gabrielle  奥兰多 Orlando  迪尔德丽 Deirdre 阿拉伦 Alaron  卡斯帕 Kaspar 安文 Anwen  卢克雷蒂娅 Lucretia 黛蕾尔 Dirael  马卡尔 Markal 鄂加 Ergar  纳蒂尔 Naadir 芬丹 Findan  奥森 Orson 吉尔里恩 Gilraen  拉雯 Raven 奥瑟 Ossir  弗拉迪米尔 Vladimir 塔兰纳 Talanar  佐尔坦 Zoltan 温利尔 Vinrael  尼科莱 Nicolai 韦恩加尔 Wyngaal  于尔辛 Ylthin  乔瓦尼 Giovanni  蒂耶鲁 Tieru  阿兰蒂尔 Arantir  欧尼拉 Ornella  布兰德 Brand 英格瓦 Ingvar  艾巴 Ebba 卡里 Karli  俄林 Erling 托尔格哈王 King Tolghar  汉格瓦尔 Hangvul 洛尔夫 Rolf  海尔玛 Helmar 斯威 Svea  英伽 Inga 乌尔夫斯坦 Wulfstan  伽如娜 Garuna 哥沙克 Gorshak  克拉格 Kragh 哈戈什 Haggash  科尔汉 Kilghan 沙-库如汉特 King Shah`Kuruhat  坦尔塞克 Telsek 厄格特 Urghat  高泰 Gotai Gottai 库金 Kujin Kujin  魁洛克 Quroq Quroq 库恩亚克 Kunyak
2023-06-20 08:23:171

八皇后问题是什么问题呀

2023-06-20 08:23:254

initgraph(); closegraph();是什么意思

初始化和关闭
2023-06-20 08:23:322

c语言程序设计的疑惑,找不到graphics.h

可能是编译器的问题吧,不同的编译器头文件不同,去下一个graphics.h好了
2023-06-20 08:23:434

七个王国的游戏-七个王国

《七个王国》在1997年上市时,虽然给许多人带来一份发自内心的惊喜,吸引了一部分忠实的王国信徒,销售纪录也还不坏,但是它也没能得到和本身质量相称的评价和注目。EnlightSoftware正在为其续集《七个王国Ⅱ》添砖加瓦,新的特性、新的游戏模式和新的功能选项都将使其成为1999年最受欢迎的即时战略作品。在《七个王国Ⅱ》里,人类总共有东亚的中国、日本、蒙古,地中海的罗马、希腊、迦太基,非洲的埃及,中东的波斯、印度,北欧的维京、诺曼第及凯尔特等12种古文明。除了人类之外,还有其他许多生物所建立起的文明,这些生物所建构的新文明将成为二代的新主轴。试玩版包含8关训练模式及2关战役。训戏剧模式由简至繁地勾勒出整体的结构,玩者可藉此了解游戏的内涵,建议各位透过训练模式来学习游戏的操作。经过3D渲染的建筑物、地形和各种战斗单位,将出现非常震撼的视觉效果。每个种族都有自己的特色科技。每一种族都将出现各自文明历史上的英雄,如罗马的凯撒、诺曼底的威廉,他们对于战争会产生戏剧性的影响。引用直接安装2000C113.exe为七个王国Ⅱ繁体中文硬盘版,没有动画和音乐。解压Movie文件夹到安装目录,游戏时载入CD.NRG,这样动画和音乐就全有了。特别注意载入CD.NRG的虚拟光驱盘符必须在所有光驱的第一个,不然还是没有音乐。当然,直接硬盘版安装同样可以进入游戏,看各位的喜好了。由于网上的繁体中文版安装文件都带有广告插件,简体中文没有破解必须用正版原盘才能进游戏,所以下决心制作了这个完整纯净硬盘镜像版,希望各位7KFAN能够喜欢作为一名即时战略游戏的爱好者,一定不会忘记由EnlightSoftware开发的《七个王国》,该游戏的复杂性和可玩性堪称即时类游戏之最!我曾经就是因为它绝佳的可玩性而乐此不疲地玩了将近半年。如今它的续作《七个王国2》(以下简称《七2》)已经制作完成并且上市。《七2》较前代又有了很大的改变,但是游戏的魅力并没有因此而减低。为了让大家早日破关,特快马加鞭献上攻略一篇。 基础篇 进入游戏后,画面的左上角有八个命令(游戏分辨率不同,它们的位置也有所不同),作用分别为:⒈王国(Kingdoms):在此可以了解你的国家与其他国家的关系,重要的是外交(Diplomacy)。⒉城市(Towns):了解你所控制的城市情况。⒊经济(Economy):随时掌握国家的收支情况。⒋贸易(Trade):了解本国贸易骆驼的交易情况。⒌军事(Military):兵营中是否有将军和士兵。⒍科技(Tech):了解自己国家掌握的科技成果和神卷(用来建造神殿的卷轴)。⒎谍报(Spies):了解你的间谍所在位置以及所干的工作。⒏评价(Rank):也就是排名,了解本国在所有国家中的排名情况,依次为人口(Population)、军事(Military)、经济(Economy)、名声(Reputation)和全面指数(Overall),在下方还有你在游戏中的得分以及游戏时间。注意游戏画面的正上方,左边变化着的数字是国家的粮食与财富,右边是当前的年月日和你的名声。如果你扮演的是恶魔,那么名声将换成生命点数(LifePoints)。画面右上方的地图中黑方块表示资源,小白方块表示恶魔巢穴,大白方块表示独立城市。点击你的城市,会出现五个命令:⒈征兵(Recruit):征出的只是未经训练的居民,会降低居民对你的忠诚度,当忠诚低于30时,城市会随时暴动。⒉迁徙(WagonTransport):将一个城市里的人迁往另一个地方建立新城市。⒊征税(CollectTax):可以增加国家收入,但也会降低居民忠诚。点击鼠标右键可设定当居民忠诚达到某个数值时自动征税。⒋给予(Grant):可提高居民忠诚,每点一下提高10点,但需付每位居民10元钱。点击鼠标右键可设定当居民忠诚低于某数值时自动给予金钱。⒌修建城墙(BuildTownWall):可提高城市的防御力,降低城市居民在战争中所受到的伤害。不同职业的人又都具有四个基本的指令:⒈攻击模式(AggressivenessMode):只要在领域内遇上敌人会自动攻击。点击一下会变为消极模式(PassiveMode),对敌人不会进行自动攻击。⒉建造(Build):每个人根据自己职业可建造相应的建筑物。⒊安居(BuildaTown):即建立一个新城市或者迁入已存在的城市。⒋荣誉(Honor):提高忠诚,但要花钱。 建筑篇 人类拥有的建筑一共有11个,具体如下:⒈营地(Camp):部队的临时驻扎建筑,没有防御设施,但经过修建可升级为兵营。⒉兵营(Fort):每个兵营可容纳1个将军和15个士兵。其作用是控制城市和训练士兵(必须有将军在内),所以兵营必须和城市相连。另外,在兵营内还可修建5个箭塔。⒊矿场(Mine):必须建在资源上,作用是生产原材料。你可通过设定工作强度(WorkforceLever)来调整工人的数量。⒋工厂(Factory):必须和矿场、城市相连,作用是将原材料制作成产品。⒌市场(Market):必须和工厂、城市相连,作用是销售商品,为国家赚取财富。⒍客栈(Inn):可随处建造,作用是让各国的流浪者歇歇脚,并可从中雇到有能力的士兵和间谍,有时还能雇到民族英雄。⒎科研塔(TowerOfScience):必须和城市相连,研究的内容很多,在后面会做具体介绍。一个科研塔可容纳20个科研员⒏兵工厂(WarFactory):必须和城市相连,作用是制造陆军用武器。⒐谍报大学(EspionageCollege):必须和城市相连,作用是训练各种间谍。⒑特殊建筑(SpecialStructure):必须和城市相连,各民族的特殊建筑是不同的,而且要通过研究才能建造,作用都是训练本民族特有兵种。⒒神殿(SeatOfPower):必须与城市相连,作用是召唤守护神。恶魔建筑中除了巢穴外,其他的建筑会依种族不同而且有所区别,具体如下:⒈巢穴(Lair):与兵营的作用一样。⒉恶魔树(Lishorr):Kharshuf族的防御设施。⒊野性恶魔树(WildeLishorr):Kharshuf族的超级防御设施,可进行自我繁殖,只要看见人类就会自动攻击。⒋毒蜂巢(BheemaHype):Bregma族的造兵建筑,训练出来的毒蜂具有一击必杀的能力。⒌毒虫窝(TarmesMownd):Bregma族的造兵建筑。⒍栖息地(Keraal):Kerassos族的召兵建筑,用来召募野兽部队。⒎炼金所(AlchemistTor):Minotavros族的生产建筑,只能建在资源上,可将矿石转化成黄金或者生命点数。⒏堡垒(Fortress):Grokken族的造兵建筑,需要四个Grokken族战士才能建成。⒐兵工厂(Vapngart):Ezpinez族独有,制造战争武器。⒑魔法塔(MageTor);Exovum族独有的魔法攻击设施。完全攻略:7个不同的种族在文明史上,有7个古老的民族在人类的文明史上曾建立过辉煌的帝国——玛雅人(Mayan)、诺曼第人(Norman)、中国人(Chinese)、日本人(Japanese)、波斯人(Persian)、希腊人(Greek)、维京人(Viking),游戏的舞台重演了这7个民族的辉煌。每次开始游戏的时候,都可以在7个帝国中选择一个开始统一世界的历程,由于文化等方面的差异,这7个帝国具有不同的特点,了解这些对游戏进程有很大的帮助。⑴玛雅人:玛雅人手执狼牙棒,有良好的技战术和强大的力量,在近距离战斗中非常出色。基本武器为狼牙棒(攻击力8—14,攻击间隔3)。⑵诺曼第人:诺曼第人的价值在于他们多变的战术,在训练中,他们不仅可以学会远距的弓箭攻击,而且还可以使用盾牌防御。基本武器为阔剑(攻击力5—10,攻击间隔3),远距武器为十字弓(攻击力7—10,攻击间隔8,需要等级50),防御武器为盾牌(需要等级30)。⑶中国人:中国人可以说是军事天才,他们各个方面的战斗力都很强。在近距离时使用的长戈十分厉害,而且只要稍经训练,也可以成为不错的弓箭手。基本武器是长戈(攻击力6—16,攻击间隔2),远距武器为弓箭(攻击力5—8,攻击间隔7,需要等级30)。⑷日本人:日本人用手中的日本刀给敌人以重创,而高等级的日本战士的致命一击更是非常可怕。基本武器为日本刀(攻击力5—8,攻击间隔2),全力一击的日本刀(攻击力32,出现间隔90)。⑸波斯人:波斯人似乎天生就是出色的弓箭手,不经过训练就可以使用弓箭,但他们在近距离作战中并不出色。他们所使用的基本武器是矛(攻击力3—6,攻击间隙3),基本远距武器为弓箭(攻击力6—12,攻击间隙6)。⑹希腊人:希腊人从小就接受严格的军事训练,从而使低等级的希腊战士也有不俗的战斗能力,他们快速的攻击常常让人不知所措。所使用的基本武器为短剑(攻击力5—8,攻击间隔为1),基本防御武器为盾牌。⑺维京人:维京人是真正的战士,在他们庞大的身躯下隐藏的是力量,维京战士在训练后更经常有出人意外的表现。他们所使用的基本武器是战斧(攻击力6—12,攻击间隔4),全力一击用的是战斧(攻击力35,出现间隔120)。
2023-06-20 08:23:521

logstash 一直在后台运行怎么关掉

input { file { path => "/home/vovo/access.log" #指定日志目录或文件,也可以使用通配符*.log输入目录中的log文件。 start_position => "beginning" }}filter { grok { match => ["message", "%{IPORHOST:client} (%{USER:ident}|-) (%{USER:auth}|-) [%{HTTPDATE:timestamp}] "(?:%{WORD:verb} %{NOTSPACE:request}(?: HTTP/%{NUMBER:http_version})?|-)" %{NUMBER:response} %{NUMBER:bytes} "(%{QS:referrer}|-)" "(%{QS:agent}|-)""]    #匹配模式 message是每段读进来的日志,IP、HTTPDATE、WORD、NOTSPACE、NUMBER都是patterns/grok-patterns中定义好的正则格式名称,对照上面的日志进行编写,冒号,(?:%{USER:ident}|-)这种形式是条件判断,相当于程序里面的二目运算。如果有双引号""或者[]号,需要在前面加进行转义。 } kv { source => "request" field_split => "&?" value_split => "=" }  #再单独将取得的URL、request字段取出来进行key-value值匹配,需要kv插件。提供字段分隔符"&?",值键分隔符"=",则会自动将字段和值采集出来。 urldecode { all_fields => true }  #把所有字段进行urldecode(显示中文)}output { #elasticsearch { # host => "localhost" # protocol => "http" #}  #把采集的数据输出到elasticsearch里面。 stdout { codec => rubydebug }  #输出到屏幕上}
2023-06-20 08:24:111

#include哪里有错啊

bu
2023-06-20 08:24:193

谁能简单说一下python几个框架的特点吧

1.CubicWebCubicWeb的最重要的功能是其代码的可重用性,由一个个代码单元组成。它灵活又强大,并且还有一些特别的功能,包括RQL查询语言和支持有效编码的语义视图功能。这是语义Web应用程序的最佳解决方案,并且提供理想的环境。作为一个程序员,我们必须了解Python这门编程语言的灵活和强大。框架的选择取决于Web应用程序的使用目的和复杂程度。测量项目所需的负荷、可扩展性和效率是关键。官方网站:http://www.cubicweb.org/2.Zope2Zope是不同Web框架集合在一起的完整家庭。与其他框架相比,zope2在当前的开发环境中对于内容管理系统是相当有限的。 Zope工具包是一个很好的库资源,允许使用重用代码和不同的库。官方网站:https://pypi.python.org/pypi/Zope23.web2pyweb2py最重要的因素是其外部零依赖,可以创建、复原、管理和修改在浏览器中的应用程序。对于一些简单的web开发任务,大部分都可以自动化快速开发。程序员甚至不需要再准备单一的开发、调试、测试、部署和数据库处理的封装包。内置的Web界面中这些都有,在使用之前也不需要进行安装。官方网站:http://www.web2py.com/4.TurboGearsTurboGears也称为是框架的终结者,因为它虽然有着其他Python框架都有的功能,却不像其他框架那样有局限性。它甚至能适用于简单的微架构项目。它给人的感觉就不像是工作在框架上,而像是在写新的功能。你可以在几分钟之内可以创建一个read-to-extend应用,并且我们可以在网上找到大量的教程。官方网站:http://www.turbogears.org/5.Pylons灵活性是pylons框架的主要特点之一。它可以将不同Python框架提供的某些最好功能,整合到同一个地方。Pyramid是pylons的第一批产品之一,它把重点放在了快速和灵活开发实践上。你可以挑选任何你认为可以提高Web开发效率的功能整合到一起。官方网站:http://www.pylonsproject.org/6.Grok它由Zope工具包提供支持,并且一开始的时候是作为一个易扩展的Zope工具箱,为了方便那些菜鸟程序员的使用而开发 的。对于Web应用,Grok不但能提供多个构件,还有一个随时可以提供支持的很好社区。它提供了一种更为简单和灵活的学习Python的模式。它配备的可DRY方法使得它成为了一个很好的工具。官方网站:http://grok.zope.org/7.Web.py之所以说这是一款非常独特的框架,主要是因为它的简单性和功能强大的开发能力。你可以用Python语言舒舒服服地编写web应用程序。你会因为它的零局限性和易用性喜欢上web.py。有些程序员可能会发现它对功能的限制比较少,因为它预留了整合的空间,所以你不必一下子加载所有的功能,尤其是那些你并不需要的。官方网站:http://webpy.org/8.PyramidPyramid以其高效率和快节奏的开发能力而出名。这个框架最妙的是包含了一些Python,Perl和Ruby提供的最独特的功能。此开源Web框架有一个独立于平台的MVC结构,提供了开发的最简途径。此外,它还是高效开发重用代码的首选平台之一。官方网站:http://www.pylonsproject.org/projects/pyramid/about9.CherryPyCherryPy起源的其中一个最重要的原因是,它与Python兼容,并且它Python化的接口允许开发人员像Python提供的其他任何模块一样将其整合。另一个优秀的特点是能够自定义各个功能,并配备了本地适配器(mod_python),使得它非常适合开发。它为每一个WSGI功能适配器提供支持,并允许CherryPy的广泛实施。官方网站:http://www.cherrypy.org/10.FlaskFlask是一款可扩展却又简单的微架构。可能刚用的时候你会觉得它缺少某些功能,如表单验证、数据库抽象层、添加常用功能的第三方库。但是,它允许扩展,使得它更易于添加所需的功能。它的有些功能如单元测试非常适用于开发,并且支持客户端应用程序使用安全的cookies。它更适用于轻量级的应用程序和项目。
2023-06-20 08:24:491

c语言 坐标

graphic.h 找找 看 吧
2023-06-20 08:24:593

几亿条的 csv 格式数据怎么快速导入 elasticsearch

input {file {type => "log"#stat_interval => " "path => "/home/hadoop/xinwang_XW351464_2110.log"}}filter {if [path] =~ "xinwang_XW351464_2110" {mutate { replace => { "type" => "apache_access" } }grok {match => { "message" => "%{COMBINEDAPACHELOG}" }}}date {match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]}}output {elasticsearch {#cluster => "logstash_ela"#node_name=> "es_master"host => "192.168.1.152"index => "eslsg"index_type => "type"protocol => "http"port => 9200workers => 1}}执行 ./logstash agent -v -f txtTes.conf 的时候出现:Grok loading patterns from file {:path=>"/home/hadoop/logstash-1.4.2/patterns/postgresql", :level=>:info}Grok loading patterns from file {:path=>"/home/hadoop/logstash-1.4.2/patterns/mongodb", :level=>:info}Grok loading patterns from file {:path=>"/home/hadoop/logstash-1.4.2/patterns/mcollective", :level=>:info}Grok loading patterns from file {:path=>"/home/hadoop/logstash-1.4.2/patterns/redis", :level=>:info}Grok loading patterns from file {:path=>"/home/hadoop/logstash-1.4.2/patterns/java", :level=>:info}Grok loading patterns from file {:path=>"/home/hadoop/logstash-1.4.2/patterns/ruby", :level=>:info}Grok loading patterns from file {:path=>"/home/hadoop/logstash-1.4.2/patterns/junos", :level=>:info}Match data {:match=>{"message"=>"%{COMBINEDAPACHELOG}"}, :level=>:info}Grok compile {:field=>"message", :patterns=>["%{COMBINEDAPACHELOG}"], :level=>:info}Pipeline started {:level=>:info}New Elasticsearch output {:cluster=>nil, :host=>"192.168.1.152", :port=>9200, :embedded=>false, :protocol=>"http", :level=>:info}Automatic template management enabled {:manage_template=>"true", :level=>:info}Using mapping template {:template=>"{ "template" : "logstash-*", "settings" : { "index.refresh_interval" : "5s" }, "mappings" : { "_default_" : { "_all" : {"enabled" : true}, "dynamic_templates" : [ { "string_fields" : { "match" : "*", "match_mapping_type" : "string", "mapping" : { "type" : "string", "index" : "analyzed", "omit_norms" : true, "fields" : { "raw" : {"type": "string", "index" : "not_analyzed", "ignore_above" : 256} } } } } ], "properties" : { "@version": { "type": "string", "index": "not_analyzed" }, "geoip" : { "type" : "object", "dynamic": true, "path": "full", "properties" : { "location" : { "type" : "geo_point" } } } } } }}", :level=>:info}
2023-06-20 08:25:061

求助:Mongodb批量导入数据方法

input {file {type => "log"#stat_interval => " "path => "/home/hadoop/xinwang_XW351464_2110.log"}}filter {if [path] =~ "xinwang_XW351464_2110" {mutate { replace => { "type" => "apache_access" } }grok {match => { "message" => "%{COMBINEDAPACHELOG}" }}}date {match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]}}output {elasticsearch {#cluster => "logstash_ela"#node_name=> "es_master"host => "192.168.1.152"index => "eslsg"index_type => "type"protocol => "http"port => 9200workers => 1}}执行 ./logstash agent -v -f txtTes.conf 的时候出现:Grok loading patterns from file {:path=>"/home/hadoop/logstash-1.4.2/patterns/postgresql", :level=>:info}Grok loading patterns from file {:path=>"/home/hadoop/logstash-1.4.2/patterns/mongodb", :level=>:info}Grok loading patterns from file {:path=>"/home/hadoop/logstash-1.4.2/patterns/mcollective", :level=>:info}Grok loading patterns from file {:path=>"/home/hadoop/logstash-1.4.2/patterns/redis", :level=>:info}Grok loading patterns from file {:path=>"/home/hadoop/logstash-1.4.2/patterns/java", :level=>:info}Grok loading patterns from file {:path=>"/home/hadoop/logstash-1.4.2/patterns/ruby", :level=>:info}Grok loading patterns from file {:path=>"/home/hadoop/logstash-1.4.2/patterns/junos", :level=>:info}Match data {:match=>{"message"=>"%{COMBINEDAPACHELOG}"}, :level=>:info}Grok compile {:field=>"message", :patterns=>["%{COMBINEDAPACHELOG}"], :level=>:info}Pipeline started {:level=>:info}New Elasticsearch output {:cluster=>nil, :host=>"192.168.1.152", :port=>9200, :embedded=>false, :protocol=>"http", :level=>:info}Automatic template management enabled {:manage_template=>"true", :level=>:info}Using mapping template {:template=>"{ "template" : "logstash-*", "settings" : { "index.refresh_interval" : "5s" }, "mappings" : { "_default_" : { "_all" : {"enabled" : true}, "dynamic_templates" : [ { "string_fields" : { "match" : "*", "match_mapping_type" : "string", "mapping" : { "type" : "string", "index" : "analyzed", "omit_norms" : true, "fields" : { "raw" : {"type": "string", "index" : "not_analyzed", "ignore_above" : 256} } } } } ], "properties" : { "@version": { "type": "string", "index": "not_analyzed" }, "geoip" : { "type" : "object", "dynamic": true, "path": "full", "properties" : { "location" : { "type" : "geo_point" } } } } } }}", :level=>:info}
2023-06-20 08:25:131

具体控制台命令英雄无敌5:东方部落

配置文件的修改大家应该都知道了,小弟在此只是分享一下控制台命令。控制台命令大体分为两部分,@命令和enable_cheats命令。先说@命令:就是开头带一个@符号的。添加技能:@GiveHeroSkill("英雄名字", 技能ID)添加生物:@AddHeroCreatures("英雄名字", CREATRUE_生物名称, 数量),或 @AddHeroCreatures("英雄名字", 生物ID, 数量) 添加战争机械:@GiveHeroWarMachine("英雄名字", 战争机器名),或 @GiveHeroWarMachine("英雄名字", 战争机器编号)添加魔法:@TeachHeroSpell(“英雄名字”, SPELL_魔法名称),或 @TeachHeroSpell(“英雄名字”, 魔法ID)添加宝物:@GiveArtifact(“英雄名字”, 宝物ID)修改英雄指数:@ChangeHeroStat("英雄名字", 指数类型, 数字),或 @ChangeHeroStat("英雄名字", 指数编号, 数字)增加资源:@SetPlayerResource(玩家编号, 资源编号, 数量)显示英雄坐标:@print(GetObjectPos("英雄名字"))直接胜利/失败:@Win() / @Loose()再说enable_cheats命令:这些命令在1.2之后要先输入 enable_cheats 才可以使用。给选中的英雄增加XX经验:add_exp XX将你的资源清空:clear_money给选中的英雄添加所有魔法:add_all_spells给选中的添加技能:add_skill 技能名称或者技能Id将你的金币设置为XX:add_gold XX (注意,会清空其它资源)显示英雄剩余移动力:show_hero_mp命令中需要用到的代码在后面给出。英雄名字Id在游戏中可以用以下命令查得英雄名字:@print(GetPlayerHeroes(PLAYER_x))x为玩家编号(1-8)中文名 游戏中英文名 控制台使用名[魔法师(Wizard)]赛勒斯 Cyrus Tan 法伊兹 Faiz Faiz 加利布 Galib Tan 哈韦兹 Havez Havez 霍拉 Jhora Sufi 马希尔 Maahir Maahir 纳克西斯 Narxes Razzak 纳西尔 Nathir Nur 努尔 Nur Astral 拉扎克 Razzak Isher 泰莫克汉 Temkhan Timerkhan 泽希尔 Zehir Zehir[术士(warlock)]埃莉娜 Eruina Eruina 基特拉 Kythra Menel 莱托兹 Lethos Dalom 雷拉格 Raelag Raelag 赛格雷夫 Segref Segref 莎蒂娅 Shadya Kelodin 塞纳特 Sinitar Inagost 索戈尔 Sorgal Ferigl 维尚 Vayshan Ohtarig 伊蓓丝 Yrbeth Almegir 宇尔沃娜 Yrwanna Urunir (命运之锤英雄)埃莉娜 Eruina Eruina_A1 雷拉格 Raelag Raelag_A1 伊拉娅 Ylaya Shadwyn 斯拉塞 Thralsai Thralsai (东方部落英雄)阿格贝斯 Agbeth Ferigl 兰勒斯 Ranleth Almegir[骑士(Knight)]杜戈尔 Dougal Orrin 埃兰妮 Ellaine Nathaniel 法蕾妲 Freyda Axel 哥德里克 Godric Godric 艾莲娜 Irina Ving 伊莎贝尔 Isabel Isabell 克劳斯 Klaus Sarge 拉兹罗 Laszlo Mardigo 玫芙 Maeve Maeve 尼科莱 Nicolai Nicolai 拉特格 Rutger Brem 维托里奥 Vittorio Christian (命运之锤英雄) 阿拉瑞克 Alaric RedHeavenHero01 拜亚拉/圣·伊莎贝尔 Biara/Saint Isabel Saint Isabell 邓肯 Duncan Duncan 法蕾妲 Freyda Freyda 伊莎贝尔 Isabel Isabell_A1 拉兹罗 Laszlo Laszlo 欧尼拉 Ornella Ornella 罗伦佐 Lorenzo RedHeavenHero02 维拉利亚 Valeria RedHeavenHero03 (东方部落英雄) 埃拉里克 Alaric Alaric 贝纳迪克特 Benedikt RedHeavenHero04 伯阐德 Bertrand RedHeavenHero05 加布里埃尔依 Gabrielle RedHeavenHero06 奥兰多 Orlando Orlando[恶魔领主(Demon lord)]阿格雷尔 Agrael Agrael 阿莱斯特 Alastor Efion 拜娅拉 Biara Biara 迪里布 Deleb Deleb 伊雷吉尔 Erasial Erasial 格劳尔 Grawl Calid 格洛克 Grok Grok耶泽蓓丝 Jezebeth Oddrema 马巴斯 Marbas Marder 内比罗斯 Nebiros Jazaz 奈穆斯 Nymus Nymus 魔王 Sovereign Kha-Beleth 维亚尔 Veyer Veyer (东方部落英雄)奥兰多 Orlando Orlando
2023-06-20 08:25:201

文本数据怎么批量导入Elasticsearch

input {file {type => "log"#stat_interval => " "path => "/home/hadoop/xinwang_XW351464_2110.log"}}filter {if [path] =~ "xinwang_XW351464_2110" {mutate { replace => { "type" => "apache_access" } }grok {match => { "message" => "%{COMBINEDAPACHELOG}" }
2023-06-20 08:25:281

用C语言编写计算器

TC下运行可以玩玩的#include <dos.h> /*DOS接口函数*/#include <math.h> /*数学函数的定义*/#include <conio.h> /*屏幕操作函数*/#include <stdio.h> /*I/O函数*/#include <stdlib.h> /*库函数*/#include <stdarg.h> /*变量长度参数表*/#include <graphics.h> /*图形函数*/#include <string.h> /*字符串函数*/#include <ctype.h> /*字符操作函数*/#define UP 0x48 /*光标上移键*/#define DOWN 0x50 /*光标下移键*/#define LEFT 0x4b /*光标左移键*/#define RIGHT 0x4d /*光标右移键*/#define ENTER 0x0d /*回车键*/void *rar; /*全局变量,保存光标图象*/struct palettetype palette; /*使用调色板信息*/int GraphDriver; /* 图形设备驱动*/int GraphMode; /* 图形模式值*/int ErrorCode; /* 错误代码*/int MaxColors; /* 可用颜色的最大数值*/int MaxX, MaxY; /* 屏幕的最大分辨率*/double AspectRatio; /* 屏幕的像素比*/void drawboder(void); /*画边框函数*/void initialize(void); /*初始化函数*/void computer(void); /*计算器计算函数*/void changetextstyle(int font, int direction, int charsize); /*改变文本样式函数*/void mwindow(char *header); /*窗口函数*/int specialkey(void) ; /*获取特殊键函数*/int arrow(); /*设置箭头光标函数*//*主函数*/int main(){ initialize();/* 设置系统进入图形模式 */ computer(); /*运行计算器 */ closegraph();/*系统关闭图形模式返回文本模式*/ return(0); /*结束程序*/}/* 设置系统进入图形模式 */void initialize(void){ int xasp, yasp; /* 用于读x和y方向纵横比*/ GraphDriver = DETECT; /* 自动检测显示器*/ initgraph( &GraphDriver, &GraphMode, "" );/*初始化图形系统*/ ErrorCode = graphresult(); /*读初始化结果*/ if( ErrorCode != grOk ) /*如果初始化时出现错误*/ { printf("Graphics System Error: %s ", grapherrormsg( ErrorCode ) ); /*显示错误代码*/ exit( 1 ); /*退出*/ } getpalette( &palette ); /* 读面板信息*/ MaxColors = getmaxcolor() + 1; /* 读取颜色的最大值*/ MaxX = getmaxx(); /* 读屏幕尺寸 */ MaxY = getmaxy(); /* 读屏幕尺寸 */ getaspectratio( &xasp, &yasp ); /* 拷贝纵横比到变量中*/ AspectRatio = (double)xasp/(double)yasp;/* 计算纵横比值*/}/*计算器函数*/void computer(void){ struct viewporttype vp; /*定义视口类型变量*/ int color, height, width; int x, y,x0,y0, i, j,v,m,n,act,flag=1; float num1=0,num2=0,result; /*操作数和计算结果变量*/ char cnum[5],str2[20]={""},c,temp[20]={""}; char str1[]="1230.456+-789*/Qc=^%";/* 定义字符串在按钮图形上显示的符号 */ mwindow( "Calculator" ); /* 显示主窗口 */ color = 7; /*设置灰颜色值*/ getviewsettings( &vp ); /* 读取当前窗口的大小*/ width=(vp.right+1)/10; /* 设置按钮宽度 */ height=(vp.bottom-10)/10 ; /*设置按钮高度 */ x = width /2; /*设置x的坐标值*/ y = height/2; /*设置y的坐标值*/ setfillstyle(SOLID_FILL, color+3); bar( x+width*2, y, x+7*width, y+height ); /*画一个二维矩形条显示运算数和结果*/ setcolor( color+3 ); /*设置淡绿颜色边框线*/ rectangle( x+width*2, y, x+7*width, y+height ); /*画一个矩形边框线*/ setcolor(RED); /*设置颜色为红色*/ outtextxy(x+3*width,y+height/2,"0."); /*输出字符串"0."*/ x =2*width-width/2; /*设置x的坐标值*/ y =2*height+height/2; /*设置y的坐标值*/ for( j=0 ; j<4 ; ++j ) /*画按钮*/ { for( i=0 ; i<5 ; ++i ) { setfillstyle(SOLID_FILL, color); setcolor(RED); bar( x, y, x+width, y+height ); /*画一个矩形条*/ rectangle( x, y, x+width, y+height ); sprintf(str2,"%c",str1[j*5+i]); /*将字符保存到str2中*/ outtextxy( x+(width/2), y+height/2, str2); x =x+width+ (width / 2) ; /*移动列坐标*/ } y +=(height/2)*3; /* 移动行坐标*/ x =2*width-width/2; /*复位列坐标*/ } x0=2*width; y0=3*height; x=x0; y=y0; gotoxy(x,y); /*移动光标到x,y位置*/ arrow(); /*显示光标*/ putimage(x,y,rar,XOR_PUT); m=0; n=0; strcpy(str2,""); /*设置str2为空串*/ while((v=specialkey())!=45) /*当压下Alt+x键结束程序,否则执行下面的循环*/ { while((v=specialkey())!=ENTER) /*当压下键不是回车时*/ { putimage(x,y,rar,XOR_PUT); /*显示光标图象*/ if(v==RIGHT) /*右移箭头时新位置计算*/ if(x>=x0+6*width) /*如果右移,移到尾,则移动到最左边字符位置*/ { x=x0; m=0; } else { x=x+width+width/2; m++; } /*否则,右移到下一个字符位置*/ if(v==LEFT) /*左移箭头时新位置计算*/ if(x<=x0) { x=x0+6*width; m=4; } /*如果移到头,再左移,则移动到最右边字符位置*/ else { x=x-width-width/2; m--; } /*否则,左移到前一个字符位置*/ if(v==UP) /*上移箭头时新位置计算*/ if(y<=y0) { y=y0+4*height+height/2; n=3; } /*如果移到头,再上移,则移动到最下边字符位置*/ else { y=y-height-height/2; n--; } /*否则,移到上边一个字符位置*/ if(v==DOWN) /*下移箭头时新位置计算*/ if(y>=7*height) { y=y0; n=0; } /*如果移到尾,再下移,则移动到最上边字符位置*/ else { y=y+height+height/2; n++; } /*否则,移到下边一个字符位置*/ putimage(x,y,rar,XOR_PUT); /*在新的位置显示光标箭头*/ } c=str1[n*5+m]; /*将字符保存到变量c中*/ if(isdigit(c)||c==".") /*判断是否是数字或小数点*/ { if(flag==-1) /*如果标志为-1,表明为负数*/ { strcpy(str2,"-"); /*将负号连接到字符串中*/ flag=1; } /*将标志值恢复为1*/ sprintf(temp,"%c",c); /*将字符保存到字符串变量temp中*/ strcat(str2,temp); /*将temp中的字符串连接到str2中*/ setfillstyle(SOLID_FILL,color+3); bar(2*width+width/2,height/2,15*width/2,3*height/2); outtextxy(5*width,height,str2); /*显示字符串*/ } if(c=="+") { num1=atof(str2); /*将第一个操作数转换为浮点数*/ strcpy(str2,""); /*将str2清空*/ act=1; /*做计算加法标志值*/ setfillstyle(SOLID_FILL,color+3); bar(2*width+width/2,height/2,15*width/2,3*height/2); outtextxy(5*width,height,"0."); /*显示字符串*/ } if(c=="-") { if(strcmp(str2,"")==0) /*如果str2为空,说明是负号,而不是减号*/ flag=-1; /*设置负数标志*/ else { num1=atof(str2); /*将第二个操作数转换为浮点数*/ strcpy(str2,""); /*将str2清空*/ act=2; /*做计算减法标志值*/ setfillstyle(SOLID_FILL,color+3); bar(2*width+width/2,height/2,15*width/2,3*height/2); /*画矩形*/ outtextxy(5*width,height,"0."); /*显示字符串*/ } } if(c=="*") { num1=atof(str2); /*将第二个操作数转换为浮点数*/ strcpy(str2,""); /*将str2清空*/ act=3; /*做计算乘法标志值*/ setfillstyle(SOLID_FILL,color+3); bar(2*width+width/2,height/2,15*width/2,3*height/2); outtextxy(5*width,height,"0."); /*显示字符串*/ } if(c=="/") { num1=atof(str2); /*将第二个操作数转换为浮点数*/ strcpy(str2,""); /*将str2清空*/ act=4; /*做计算除法标志值*/ setfillstyle(SOLID_FILL,color+3); bar(2*width+width/2,height/2,15*width/2,3*height/2); outtextxy(5*width,height,"0."); /*显示字符串*/ } if(c=="^") { num1=atof(str2); /*将第二个操作数转换为浮点数*/ strcpy(str2,""); /*将str2清空*/ act=5; /*做计算乘方标志值*/ setfillstyle(SOLID_FILL,color+3); /*设置用淡绿色实体填充*/ bar(2*width+width/2,height/2,15*width/2,3*height/2); /*画矩形*/ outtextxy(5*width,height,"0."); /*显示字符串*/ } if(c=="%") { num1=atof(str2); /*将第二个操作数转换为浮点数*/ strcpy(str2,""); /*将str2清空*/ act=6; /*做计算模运算乘方标志值*/ setfillstyle(SOLID_FILL,color+3); /*设置用淡绿色实体填充*/ bar(2*width+width/2,height/2,15*width/2,3*height/2); /*画矩形*/ outtextxy(5*width,height,"0."); /*显示字符串*/ } if(c=="=") { num2=atof(str2); /*将第二个操作数转换为浮点数*/ switch(act) /*根据运算符号计算*/ { case 1:result=num1+num2;break; /*做加法*/ case 2:result=num1-num2;break; /*做减法*/ case 3:result=num1*num2;break; /*做乘法*/ case 4:result=num1/num2;break; /*做除法*/ case 5:result=pow(num1,num2);break; /*做x的y次方*/ case 6:result=fmod(num1,num2);break; /*做模运算*/ } setfillstyle(SOLID_FILL,color+3); /*设置用淡绿色实体填充*/ bar(2*width+width/2,height/2,15*width/2,3*height/2); /*覆盖结果区*/ sprintf(temp,"%f",result); /*将结果保存到temp中*/ outtextxy(5*width,height,temp); /*显示结果*/ } if(c=="c") { num1=0; /*将两个操作数复位0,符号标志为1*/ num2=0; flag=1; strcpy(str2,""); /*将str2清空*/ setfillstyle(SOLID_FILL,color+3); /*设置用淡绿色实体填充*/ bar(2*width+width/2,height/2,15*width/2,3*height/2); /*覆盖结果区*/ outtextxy(5*width,height,"0."); /*显示字符串*/ } if(c=="Q")exit(0); /*如果选择了q回车,结束计算程序*/ } putimage(x,y,rar,XOR_PUT); /*在退出之前消去光标箭头*/ return; /*返回*/}/*窗口函数*/void mwindow( char *header ){ int height; cleardevice(); /* 清除图形屏幕 */ setcolor( MaxColors - 1 ); /* 设置当前颜色为白色*/ setviewport( 20, 20, MaxX/2, MaxY/2, 1 ); /* 设置视口大小 */ height = textheight( "H" ); /* 读取基本文本大小 */ settextstyle( DEFAULT_FONT, HORIZ_DIR, 1 );/*设置文本样式*/ settextjustify( CENTER_TEXT, TOP_TEXT );/*设置字符排列方式*/ outtextxy( MaxX/4, 2, header ); /*输出标题*/ setviewport( 20,20+height+4, MaxX/2+4, MaxY/2+20, 1 ); /*设置视口大小*/ drawboder(); /*画边框*/}void drawboder(void) /*画边框*/{ struct viewporttype vp; /*定义视口类型变量*/ setcolor( MaxColors - 1 ); /*设置当前颜色为白色 */ setlinestyle( SOLID_LINE, 0, NORM_WIDTH );/*设置画线方式*/ getviewsettings( &vp );/*将当前视口信息装入vp所指的结构中*/ rectangle( 0, 0, vp.right-vp.left, vp.bottom-vp.top ); /*画矩形边框*/}/*设计鼠标图形函数*/int arrow(){ int size; int raw[]={4,4,4,8,6,8,14,16,16,16,8,6,8,4,4,4}; /*定义多边形坐标*/ setfillstyle(SOLID_FILL,2); /*设置填充模式*/ fillpoly(8,raw); /*画出一光标箭头*/ size=imagesize(4,4,16,16); /*测试图象大小*/ rar=malloc(size); /*分配内存区域*/ getimage(4,4,16,16,rar); /*存放光标箭头图象*/ putimage(4,4,rar,XOR_PUT); /*消去光标箭头图象*/ return 0;}/*按键函数*/int specialkey(void){ int key; while(bioskey(1)==0); /*等待键盘输入*/ key=bioskey(0); /*键盘输入*/ key=key&0xff? key&0xff:key>>8; /*只取特殊键的扫描值,其余为0*/ return(key); /*返回键值*/}
2023-06-20 08:25:385

c语言绘制二叉树

你那里是打印出的啥?不会是没有存下数据打印了乱码吧?:) [修改]比如,我把和你的二叉树相关的代码去掉,改了一下:#include <stdio.h>#include <stdlib.h>#include <string.h>#include <conio.h>#include <graphics.h>int main(){ char str[10]; int x = 100, y = 100; int e = 9; /* select a driver and mode that supports */ /* multiple drawing colors. */ int gdriver = DETECT, gmode = VGA, errorcode; detectgraph(&gdriver, &gmode); /* initialize graphics and local variables */ initgraph(&gdriver, &gmode, "d:\bc\bgi"); /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ { printf("Graphics error: %s ", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* terminate with an error code */ } setcolor(BLACK); setfillstyle(SOLID_FILL,BLACK); fillellipse(x,y,9,9); setcolor(WHITE); circle(x,y,10); sprintf(str,"%d",e); outtextxy(x-3,y-2,str); /* clean up */ getch(); /* colse */ closegraph(); return 0;}就能在圈圈里打印出"9"
2023-06-20 08:26:041

什么是博克?

博客吧?blog的意思...就是在网上搞个个人写心情日记等的个人网站似的的东西
2023-06-20 08:26:112

C语言程序里"BAR"是什么意思

  bar是一个函数名。  功 能: 画一个二维条形图  用 法: void far bar(int left,int top,int right,int bottom);  C语言是一种计算机程序设计语言,属高级语言范畴。它既具有高级语言的特点,又具有汇编语言的特点。它可以作为工作系统设计语言,编写系统应用程序,也可以作为应用程序设计语言,编写不依赖计算机硬件的应用程序,代码清晰精简,十分灵活。  
2023-06-20 08:26:212

c语言常用函数

我有一个C语言函数查询软件 如果你想要留言我发给你!!!!!!!!!
2023-06-20 08:26:313

如何把 opengrok 安装在 windows上

opengrok 是目前最好用的代码索引、浏览工具,比sourceinsight好狠多。假设已经有一台安装好tomcat服务的机器。此时不需要启动tomcat下载opengrok binary。  把opengrok binary解压到根目录下。我这里是c:/opengrok盘根目录把C:opengroklibsource.war这个文件拷贝到tomcatwebapps文件夹里编辑tomcatwebappssourceWEB-INFweb.xml文件,如图opengrok将会生成configuration.xml文件。到目前为止还没有这个文件,先这么改着。目录结构如图。另外创建data和source两个文件夹,后面会用到。下载安装ctags。 到官网下载把ctags解压的根目录下。比如c:ctags,然后把c:ctags加入到系统路径下把要建立索引的源代码拷贝到c:opengroksource,就是刚才建立好的一个source文件夹启动cmd,也就是dos命令窗口执行java -Xmx524m -jar libopengrok.jar -W "C:\OpenGrok\data\configuration.xml" -P -S -v -s "C:\OpenGrok\source" -d "C:\OpenGrok\data"等命令结束后,在浏览器中执行http //localhost 8080/source就可以使用了
2023-06-20 08:26:391

C语言中的initgraph函数

initgraph()功 能: 初始化图形系统函数原型: void far initgraph(int far *graphdriver, int far *graphmode,char far *pathtodriver);头文件:graphics.h程序示例#include "graphics.h"#include "stdio.h"int main(void){/* request auto detection */int gdriver = DETECT, gmode, errorcode;/* initialize graphics mode */initgraph(&gdriver, &gmode, "");/* read result of initialization */errorcode= graphresult();if (errorcode != grOk) /* an error occurred */{printf("Graphics error: %s ", grapherrormsg(errorcode));printf("Press any key to halt:");getch();exit(1); /* return with error code */}/* draw a line */line(0, 0, getmaxx(), getmaxy());/* clean up */getch();closegraph();return 0;}
2023-06-20 08:26:482

python成熟的企业级应用框架有哪些

1、首先推荐成熟的python web模式是:Pyramid 它是由Pylons和repoze.bfg合并而成的新项目。2、其它的还有很多的,简单列一下。TurboGears,Bottle,Flask,Grok,Quixote,Tornado,web.py,web2py,Webware,Werkzeug,Karrigell,Cubicweb,PureMVC等。推荐这几个:Pyramid,Bottle,Flask,Tornado,web.py。
2023-06-20 08:26:571

计算器c语言代码

你这个代码的问题太多了,下面已经给你一一改过来了,并且编译运行通过了,自己比较一下: 你原先的错误都给你标出来了:#include<stdio.h> void displaymenu() //这个函数应该放在main函数外面进行定义{ printf(" ***************************** "); printf("* 1.加法 * "); printf("* 2.?法 * "); printf("* 3.乘法 * "); printf("* 4.除法 * "); printf("* 5.求余 * "); printf("* 6.?乘 * "); printf("* 7.累加 * "); printf("* 8.?束 * "); printf("***************************** "); printf("????型<1,2,3,4,5,6,7,8>? "); } main() { while(1) //这里应该是while(1),以实现循环的执行 { displaymenu(); //这里原先笔误成menu()了,应该是displaymenu()int a=0; scanf("%d",&a); switch(a) { case 1: {//int i=0,j=0,add=0; 这里少定义了一个sum=0;int i=0,j=0,add=0,sum=0; scanf("%d%d",&i,&j); sum=i+j; printf("add=%d ",sum); };break; case 2: {int i=0,j=0,sub=0; scanf("%d%d",&i,&j); sub=i-j; printf("sub=%d ",sub); };break; case 3: {int i=0,j=0,multi=0; scanf("%d%d",&i,&j); multi=i*j; printf("multi=%d ",multi); };break; case 4: {int i=0,j=0; float divide=0; scanf("%d%d",&i,&j); divide=i/j; if(j=0) printf("erro "); else printf("divide=%lf ",divide); };break; case 5: {int i=0,j=0,arith_compliment=0; //这里原先的arith-compliment,不是C语言的合法变量名(变量名中不能有“-”)scanf("%d%d",&i,&j); arith_compliment=i%j; printf("arith-compliment=%d ",arith_compliment); };break; case 6: {int i=0; float fac=1.0; for(i=1;i<=9;i++) fac=fac*i; printf(" "); printf("fac=%lf",fac); };break; case 7: {int i=0,sum_N=0; for(i=0;i<=9;i++) sum_N=sum_N+i; printf(" "); printf("sum_N=%d",sum_N); };break; } } }
2023-06-20 08:27:082

如何用C语言实现一元多项式简单计算器的设计

编了两天,希望楼主打赏点财富值#include <stdio.h>#include <malloc.h>#include <stdlib.h>struct polylink{ char ch; /*变量名*/ float coef; /* 系数域*/ int expn; /* 指数域*/ struct polylink *next; /* 链域*/ };/*初始化链表*/polylink *initpoly(){ polylink *p; p = (polylink *)malloc(sizeof(polylink)); if(p == NULL) { printf("memory error!"); exit(0); } p->next = NULL; return p;}/*销毁链表*/void destroy_link(polylink *p){ polylink *q; while(p != NULL) { q = p; p = p->next; free(q); }}/*将多项式存入链表*/polylink * creat_ploy(polylink *p){ char c[1]; int i = 0, n=0; polylink *p1; p = initpoly(); printf("input variable"s name 输入变量名: "); scanf("%s", c); printf("input the polynomial"s number 输入多项式项数: "); scanf("%d", &n); for(i = 0; i < n; i++) { p1 = (polylink *)malloc(sizeof(polylink)); if(p1 == NULL)/*分配不成功时*/ { printf("memory error!"); exit(0); } printf("input the %dst"s coefficient 输入第%d项的系数: ", i+1, i+1); scanf("%f", &p1->coef); printf("input the variable"s index 输入变量的指数: "); scanf("%d", &p1->expn); p1->ch = c[0]; p1->next = p->next; p->next = p1; } return p;}/*删除节点函数*/ polylink *delnode(polylink * h , polylink * maxp) /*删除一个节点,返回剩下的链表首地址*/ { polylink *t; t = h; while(t->next != maxp ) t=t->next; /*找到maxp 的前节点t */ t->next = maxp->next ; /*删除maxp,maxp后面的接到t后面*/ maxp->next = NULL; return h; /*链首依然是h ,返回 */ } /*求表长函数*/ void link_lenth(polylink *p, int &a)/* &是引用*/ { while(p->next != NULL) { p = p->next; a++; } }/*排序*/polylink *sort(polylink *h) { int min; /*保存指数最小的值*/ polylink *t=NULL, *minp=NULL, *head=NULL; if(h ->next == NULL) { printf("don"t exist number"); exit(0); } while(h->next !=NULL) /*只要当前链中不为空就循环 */ { t= h->next; // t :临时指针 min=t->expn; minp=t; /*把当前t中的值作为最小*/ while (t->next !=NULL) /*只要t后面还有节点就循环*/ { t=t->next ; /*t往后移动一个*/ if (t->expn < min) /*如果t中的值大于maxn,则记下其值和位置*/ { min = t->expn; minp=t; } } /*找出当前头开始在链中最大节点 maxp*/ h = delnode(h, minp); /*删除minp节点,返回剩下的链表*/ minp->next=head; /*将每次的最小节点接在头结点之前*/ head = minp; /*head 重新回到该链的开头*/ } h->next = head; /*将head 接在头节点之后*/ return h; }/*对一元多项式求导*/polylink *poly_derivation(polylink *p){ polylink *n, *q; q= p; if(p->next == NULL) { printf("polynomial don"t exist! "); } while(p->next != NULL) { p = p->next; if(p->expn == 0 || p->coef == 0) /*指数为零或者系数为零就删除*/ { q = delnode(q, p); } } n = q; /*保存删除无用节点的链表之后的头结点, 用于返回*/ if(q->next == NULL) { printf("polynomial don"t exist! "); } while(q->next != NULL) { q = q->next; q->coef = q->coef * q->expn; /*系数乘指数*/ q->expn = q->expn - 1; /*指数减一*/ } return n;}/*显示多项式*/void display_poly(polylink *p){ int a; p = sort(p); /*排序*/ while(p->next != NULL ) { p = p->next; a = 1; if(p->coef < 0) a = 0; a ? printf(" +"): printf(" "); printf("%.1f%c^%d", p->coef, p->ch, p->expn); } printf(" ");}/*查找函数*/polylink *locate_link(polylink *p, int index){ p = p->next; while(p != NULL && p->expn != index) p = p->next; if(p == NULL) return NULL; else return p;}/*为了代码重用*/void creat(polylink *&p1, polylink *&p2){ p1 = creat_ploy(p1); /*创建多项式*/ printf("another polynomial building: "); p2 = creat_ploy(p2); /*创建多项式*/ printf("first : "); display_poly(p1); /*显示创建的多项式*/ printf("the second: "); display_poly(p2); /*显示创建的多项式*/}/*多项式相加*/polylink * poly_add(polylink *head1, polylink *head2, char a){ char ch[1]; polylink *p1, *p2, *p, *r; p1 = head1; p2 = head2; if(a == "+") /*其他函数调用时不执行*/ { system("cls"); creat(p1, p2); /*创建p1 p2*/ } r = p1; while(r->next != NULL) { p1 = r->next; r = delnode(r, p1); /*删除p1*/ p = locate_link(p2, p1->expn); /*查找p2中是否有 系数等于p1->expn的节点,有就返回该点,否则返回NULL*/ if(p != NULL) p->coef = p->coef + p1->coef; else /*把节点p1插入到链表p2*/ { p1->next = p2->next; p2->next = p1; } } if(a == "+") /*被减或者乘运算时不调用*/ { printf("add result: "); display_poly(p2); /*显示*/ printf("whether to derivat:y/n "); scanf("%s", ch); if( ch[0] == "Y" || ch[0] == "y") { p2 = poly_derivation(p2); display_poly(p2); destroy_link(p2); /*销毁链表*/ } else destroy_link(p2);/*销毁链表*/ getchar();/*让屏幕显示停在运算结果*/ return NULL; } return p2;}/*多项式相减*/void poly_sub(polylink *p1, polylink *p2){ char ch[1]; polylink *n, *p; system("cls"); /*清屏*/ creat(p1, p2); p = p2; while(p->next != NULL) { p = p->next; p->coef = -1 * p->coef; } printf(" sub 1st - 2st "); n = poly_add(p1, p2, "-"); /*调用加运算函数*/ display_poly(n); printf("whether to derivat:y/n "); scanf("%s", ch); if( ch[0] == "Y" || ch[0] == "y") { n = poly_derivation(n); /*求导*/ display_poly(n); destroy_link(n); } else destroy_link(n); getchar();}/*多项式相乘*/polylink *multiply(polylink *p, float coef, int index){ /*传入系数和指数,分别与p的每个节点运算 最后返回该链*/ polylink *q, *n; n = (polylink *)malloc(sizeof(polylink)); n->next = NULL; /*n作为头节点*/ while(p->next != NULL) { p = p->next; q = (polylink *)malloc(sizeof(polylink)); q->ch = p->ch; q->coef = coef * p->coef; q->expn = index + p->expn; q->next = n->next; n->next = q; } return n;}/*多项式相乘所用,另外为了提高代码重用性*/void run_mul(polylink *p1, polylink *p2, int num){ int i = 0; char ch[1]; polylink **p, *q; /*二维指针存每次multiply()函数返回的链表*/ p = (polylink **)malloc( num *sizeof(polylink)); while(p1->next != NULL) { p1 = p1->next; p[i++] = multiply(p2, p1->coef, p1->expn); } q = poly_add(p[0], p[1], "*"); for(i = 2; i < num; i++) { q = poly_add(q, p[i], "*"); } printf("mul result: "); display_poly(q); printf("whether to derivat:y/n "); scanf("%s", ch); if( ch[0] == "Y" || ch[0] == "y") { q = poly_derivation(q); display_poly(q); destroy_link(q); } else destroy_link(q); getchar();}void poly_mul(polylink *p1, polylink *p2){ int num1 =0 , num2 = 0; /*用于存放p1 ,p2的表长*/ system("cls"); creat(p1, p2); link_lenth(p1, num1); link_lenth(p2, num2); if(num2 >= num1) /*根据链表*/ { run_mul(p1, p2, num1); } else { run_mul(p2, p1, num2); }} /*选择函数*/int menu_select() { int n; printf("press enter key to enter the menu......"); /*按任一键进入主菜单*/ getchar(); /*从键盘读取一个字符,但不显示于屏幕*/ system("cls"); /*清屏*/ printf(" "); printf(" It just for a variables "); printf(" *************************************MENU*********************** "); printf(" 1. 多项式相加 add operation "); printf(" 2. 多项式相减 sub operation "); /*显示*/ printf(" 3. 多项式相乘 mul operation "); /*寻找*/ printf(" 4. 退出 Quit "); /*删除*/ printf(" **************************************************************** "); do{ printf(" 输入你的选择Enter your choice(1~4):"); scanf("%d",&n); }while(n < 1 || n > 4); /*如果选择项不在1~4之间则重输*/ return n; /*返回选择项,主函数根据该数调用相应的函数*/ } void main() { polylink *head1=NULL, *head2=NULL, *head3=NULL; /*head3的作用不是很大*/ for(;;) /*循环无限次*/ { switch( menu_select() ) { case 1: head3 = poly_add(head1, head2, "+"); break; case 2: poly_sub(head1, head2); break; case 3: poly_mul(head1, head2); break; case 4: exit(0); /*如菜单返回值为4则程序结束*/ } } }
2023-06-20 08:27:231