c语言程序bar,c语言程序设计报告心得体会

本文目录一览:

C语言的画图函数除了bar函数外还有哪些?

与图形有关的函数

GRAPHICS.H 库文件

bar

【功能】画出一条栏目。

【原型】void far bar(int left,int top,int right,int bottom)

【位置】graphics.hgraphics.h

【参见】bar3d,setfillstyle,rectangle

bar3d

【功能】画出一条3-D栏目。

【原型】void far bar3d(int left,int top,int right,int bottom,int depth,int topflag)

【位置】graphics.h

【参见】bar

circle

【功能】以(x,y)为圆心按照指定的半径画出一个圆。

【原型】void far circle(int x,int y,int radius)

【位置】graphics.h

【参见】arc

cleardevice

【功能】清除图形画面。

【原型】void far cleardevice(void)

【位置】graphics.h

【参见】clearviewport

clearviewport

【功能】清除当前可视区域。

【原型】clearviewport(void)

【位置】graphics.h

【参见】setviewport,cleardevice

closegraph

【功能】关闭图形系统。

【原型】void far closegraph(void)

【位置】graphics.h

【参见】initgraph

detecgraph

【功能】通过检查硬件确定使用的图形驱动程序和模式。

【原型】void far detectgraph(int far *graphdriver,int far *graphmode)

【位置】graphics.h

【参见】initgraph,graphresult

drawpoly

【功能】画出一个多边形的轮廓。

【原型】void far drawpoly(int numpoints,int far polypoints[])

【位置】graphics.h

【说明】polypoints中包括一共numpoints对数值。其中每一对都给出了多边形中一个顶点的x和y值。

【参见】fillpoly

ellipse

【功能】画出一条椭圆形的圆弧。

【原型】void far ellipse(int x,int y,int stangle,int endangle,int xradius,int yradius)

【位置】graphics.h

【说明】中心点在(x,y),stangle和endangle表示一角度为单位的起始角和终止角。Xradius和yradius表示水平轴和垂直轴。

【参见】arc,circle,fillellipse

fillellipose

【功能】画出椭圆形圆弧,并填充。

【原型】void far fillllipse(int x,int y,int xradius,int yradius)

【位置】graphics.h

【说明】使用(x,y)作为中心点,然后使用当前的填充模式填充圆弧。Xradius和yradius表示水平轴和垂直轴。

【参见】arc,circle,ellipse,pieslice

fillpoly

【功能】画出一个多边形,并填充。

【原型】void far fillpoly(int numpoints,int far polypoints[])

【位置】graphics.h

【说明】polypoints中包含有numpoints对数值。其中每一对给出了多边形一个顶点的x值和y值。

【参见】drawpoly,fill_patterns,floodfill,graphresult,setfillstyle

floodfill

【功能】填充一个有界区域范围。

【原型】void far floodfill(int x,int y,int border)

【位置】graphics.h

【参见】drawpoly,fillpoly,fill_patterns,graphresult,setfillstyle

getarccoords

【功能】得到最后一次调用arc的坐标值。

【原型】void far getaerccoords(struct arccoordstype far *arccoords)

【位置】graphics.h

【参见】arc

getaspectratio

【功能】得到当前图形模式的纵横比。

【原型】void far getaspectratio(int far *xasp,int far *yasp)

【位置】graphics.h

【说明】are及类似函数使用纵横比令圆圈更加圆,而不会像椭圆。Yasp应当为10000。当象素为VGA平方并且10000时,xasp使用10000数值。

【参见】arc,setaspectratio

getbkcolor

【功能】返回当前背景颜色。

【原型】int far getbkcolor(void)

【位置】graphics.h

【参见】setbkcolor,getcolor,getpalette

getcolor

【功能】返回当前画笔的颜色。

【原型】int far getcolor(void)

【位置】graphics.h

【参见】getbkcolor,setcolor,getmaxcolor,getpalette

getdefaultpalette

【功能】返回调色板定义结构。

【原型】struct palettetype *far getdefaultpalette(void)

【位置】graphics.h

【说明】返回一个指针,指向调用initgraph初始化时,当前驱动程序的默认调色板结构。

【参见】getpalette,initgraph

getdrivername

【功能】返回一个指针,指向当前图形驱动程序的名称。

【原型】char *far getdrivername(void)

【位置】graphics.h

【说明】返回的指针指向标识当前驱动器程序的字符串,从而可以探测到硬件适配器。

【参见】initgraph

getfillpattern

【功能】将用户定义的填充模式复制到内存中。

【原型】void far getfillpattern(char far *pattern)

【位置】graphics.h

【参见】getfillsettings,setfillpattern,fill_patterns

getfillsettings

【功能】得到当前填充模式及其颜色的有关信息。

【原型】void far getfillsettings(struct fillsettingstype far *fillinfo)

【位置】graphics.h

【参见】floodfill, fillpoly, setfillstyple, pieslice, setfillpattern, bar3d, bar, getfillpattern

getgraphmode

【功能】返回当前图形模式。

【原型】int far getgraphmode(void)

【位置】graphics.h

【说明】必须先调用initgraph或者setgraphmode。

【参见】setmoderange,restorectrtmode

getimage

【功能】将制定区域的位图保存到内存中。

【原型】void far getimage(int left,int top,int right,int bottom,void far *bitmap)

【位置】graphics.h

【参见】imagesize,putimage

因为太多了,无法一一列出。比如下面的:

putimage

putpixel

rectangle

registerbgidriver

registerbgifont

restorecrtmode

sector

setactivepage

setallpalette

setaspectratio

setbkcolor

setcolor

setfillpattern

setfillstyle

setgraphbufsize

setgraphmode

setlinestyle

setpalette

setrgbcolor

setrgbpalette

settextjustify

settextstyle

setusercharsize

setviewport

setvisualpage

setwritemode

textheight

textwidth

建议你买本专业的书籍学习查看。

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

函数名: bar

功 能: 画一个二维条形图

用 法: void far bar(int left, int top, int right, int bottom);

程序例:

#include

#include

#include

#include

int main(void)

{

/* request auto detection */

int gdriver = DETECT, gmode, errorcode;

int midx, midy, i;

/* initialize graphics and local variables */

initgraph(gdriver, gmode, “”);

/* read result of initialization */

errorcode = graphresult();

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

{

printf(“Graphics error: %s\n”, grapherrormsg(errorcode));

printf(“Press any key to halt:”);

getch();

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

}

midx = getmaxx() / 2;

midy = getmaxy() / 2;

/* loop through the fill patterns */

for (i=SOLID_FILL; i

{

/* set the fill style */

setfillstyle(i, getmaxcolor());

/* draw the bar */

bar(midx-50, midy-50, midx+50,

midy+50);

getch();

}

/* clean up */

closegraph();

return 0;

}

c语言的bar()函数和 rectangle()函数

bar画一个填充矩形 填充颜色由 setfillstyle决定

rectangle画一个空矩形框,线条颜色由setcolor决定

原创文章,作者:小蓝,如若转载,请注明出处:https://www.506064.com/n/256508.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
小蓝小蓝
上一篇 2024-12-15 12:41
下一篇 2024-12-15 12:41

相关推荐

  • Python程序需要编译才能执行

    Python 被广泛应用于数据分析、人工智能、科学计算等领域,它的灵活性和简单易学的性质使得越来越多的人喜欢使用 Python 进行编程。然而,在 Python 中程序执行的方式不…

    编程 2025-04-29
  • python强行终止程序快捷键

    本文将从多个方面对python强行终止程序快捷键进行详细阐述,并提供相应代码示例。 一、Ctrl+C快捷键 Ctrl+C快捷键是在终端中经常用来强行终止运行的程序。当你在终端中运行…

    编程 2025-04-29
  • Python程序文件的拓展

    Python是一门功能丰富、易于学习、可读性高的编程语言。Python程序文件通常以.py为文件拓展名,被广泛应用于各种领域,包括Web开发、机器学习、科学计算等。为了更好地发挥P…

    编程 2025-04-29
  • AES加密解密算法的C语言实现

    AES(Advanced Encryption Standard)是一种对称加密算法,可用于对数据进行加密和解密。在本篇文章中,我们将介绍C语言中如何实现AES算法,并对实现过程进…

    编程 2025-04-29
  • 学习Python对学习C语言有帮助吗?

    Python和C语言是两种非常受欢迎的编程语言,在程序开发中都扮演着非常重要的角色。那么,学习Python对学习C语言有帮助吗?答案是肯定的。在本文中,我们将从多个角度探讨Pyth…

    编程 2025-04-29
  • Python购物车程序

    Python购物车程序是一款基于Python编程语言开发的程序,可以实现购物车的相关功能,包括商品的添加、购买、删除、统计等。 一、添加商品 添加商品是购物车程序的基础功能之一,用…

    编程 2025-04-29
  • 爬虫是一种程序

    爬虫是一种程序,用于自动获取互联网上的信息。本文将从如下多个方面对爬虫的意义、运行方式、应用场景和技术要点等进行详细的阐述。 一、爬虫的意义 1、获取信息:爬虫可以自动获取互联网上…

    编程 2025-04-29
  • Python被称为胶水语言

    Python作为一种跨平台的解释性高级语言,最大的特点是被称为”胶水语言”。 一、简单易学 Python的语法简单易学,更加人性化,这使得它成为了初学者的入…

    编程 2025-04-29
  • Vb运行程序的三种方法

    VB是一种非常实用的编程工具,它可以被用于开发各种不同的应用程序,从简单的计算器到更复杂的商业软件。在VB中,有许多不同的方法可以运行程序,包括编译器、发布程序以及命令行。在本文中…

    编程 2025-04-29
  • Python一元二次方程求解程序

    本文将详细阐述Python一元二次方程求解程序的相关知识,为读者提供全面的程序设计思路和操作方法。 一、方程求解 首先,我们需要了解一元二次方程的求解方法。一元二次方程可以写作: …

    编程 2025-04-29

发表回复

登录后才能评论