c语言画圆函数出错画一个圆

(window.slotbydup=window.slotbydup || []).push({
id: '2081942',
container: s,
size: '1000,60',
display: 'inlay-fix'急求C语言中怎样画一个圆形图形?_百度知道
急求C语言中怎样画一个圆形图形?
提问者采纳
caic&#92,), 50).h&gt,50为半径, 0; initgraph(&gdriver, &*设置作图颜色*/ setbkcolor(BLUE), 100;return 0, &*画一个以(100;c;arc(100;#include&cleardevice();closegraph();*设背景颜色*&#47, 360;\\ /bgi&quot.h&gt, &#47,100)为圆心;getch(); gdriver=DETECT;*turbo c2.0下编译通过*//stdlib:&#92,从0度到360度的圆*&#47#include&setcolor(12); }/int main(){int gdriver
谢谢你 问题已经挂了这么久了。忽然想起了不过你的回答很满意。。。希望可以加你的QQ以后有什么问题就及时向你请教?
提问者评价
其他类似问题
为您推荐:
c语言的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁君,已阅读到文档的结尾了呢~~
一个学用circle画圆形的C语言程..
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
一个学用circle画圆形的C语言程序
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口所有回答(2)
这个只有TC上能用,你如果要学学画线,画图这类的,可以去学一下 opengl
& private void CreateImg() &&&&&&& { &&&&&&&&&&& String[] m = m1;
&&&&&&&&&&& if (getMax() &= 60 && getMax() & 80) &&&&&&&&&&& { &&&&&&&&&&&&&&& m = m2; &&&&&&&&&&& } &&&&&&&&&&& else if (getMax() &= 80) &&&&&&&&&&& { &&&&&&&&&&&&&&& m = m3; &&&&&&&&&&& }
&&&&&&&&&&& int height = Convert.ToInt32(ImgHeight), width = Convert.ToInt32(ImgWidth); &&&&&&&&&&& Bitmap image = new Bitmap(width, height); &&&&&&&&&&& //创建Graphics类对象 &&&&&&&&&&& Graphics g = Graphics.FromImage(image); &&&&&&&&&&& try &&&&&&&&&&& { &&&&&&&&&&&&&&& Font font = xTextF//X轴字体 &&&&&&&&&&&&&&& Font font2 = yTextF//Y轴字体 &&&&&&&&&&&&&&& LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, image.Width, image.Height), &&&&&&&&&&&&&&& Color.Blue, Color.BlueViolet, 1.2f, true); &&&&&&&&&&&&&&& g.FillRectangle(Brushes.WhiteSmoke, 0, 0, width, height); &&&&&&&&&&&&&&& g.Clear(Color.Transparent);//此代码放的位置决定显示//清空图片背景色为透明& &&&&&&&&&&&&&&& //g.Clear(Color.White); &&&&&&&&&&&&&&& // Brush brush1 = new SolidBrush(Color.Blue); &&&&&&&&&&&&&&& //g.DrawString("成绩统计柱状图", font1, brush, new PointF(70, 30)); &&&&&&&&&&&&&&& //画图片的边框线 &&&&&&&&&&&&&&& //g.DrawRectangle(new Pen(Color.Blue), 0, 0, image.Width - 1, image.Height - 1);&&&&&&&&& &&&&&&&&&&&&&&& //绘制线条 &&&&&&&&&&&&&&& //绘制竖向线条 &&&&&&&&&&&&&&& //for (int i = 0; i & 14; i++) &&&&&&&&&&&&&&& //{ &&&&&&&&&&&&&&& //g.DrawLine(mypen, x, 80, x, 340);//绘制除y轴外的其它竖向线条 &&&&&&&&&&&&&&& //&&& x = x + 40; &&&&&&&&&&&&&&& //}&&&&&&&&&&& &&&&&&&&&&&&&&& //x = 0; &&&&&&&&&&&&&&& //绘制横向线条 &&&&&&&&&&&&&&& //for (int i = 0; i & 9; i++) &&&&&&&&&&&&&&& //{ &&&&&&&&&&&&&&& //g.DrawLine(mypen, 60, y, 620, y);//绘制除x轴外的横向线条 &&&&&&&&&&&&&&& //&&& y = y + 26; &&&&&&&&&&&&&&& //} &&&&&&&&&&&&&&& Pen mypen = new Pen(brush, 1); &&&&&&&&&&&&&&& Pen mypen1 = new Pen(yColor, pyWidth); &&&&&&&&&&&&&&& g.DrawLine(mypen1, xWidth, 0, xWidth, height - yHeight);//绘制y轴 &&&&&&&&&&&&&&& Pen mypen2 = new Pen(xColor, pxWidth); &&&&&&&&&&&&&&& g.DrawLine(mypen2, xWidth, height - yHeight, width, height - yHeight);//绘制X轴 &&&&&&&&&&&&&&& //x轴 &&&&&&&&&&&&&&& int xrowWidth = (int)(Math.Ceiling(g.MeasureString(getTextWidth(), font).Width));//文字的宽度 &&&&&&&&&&&&&&& int xrowHeight = (int)(Math.Ceiling(g.MeasureString("测试", font, 100, StringFormat.GenericTypographic).Height));//文字的高度 &&&&&&&&&&&&&&& int xspan = (int)Math.Ceiling((float)(Convert.ToInt32(ImgWidth) - xWidth - chartXSpan - pyWidth - xrowWidth) / (cachede.Count - 1));//绘制的坐标为起始坐标,正常绘制的长度会多出一组字符串的长度(长度为x,绘制n组字符串,则算坐标区间时应减去一组字符串的长度) &&&&&&&&&&&&&&& int x = xWidth + chartXS &&&&&&&&&&&&&&& foreach (KeyValuePair&string, string& kvp in cachede) &&&&&&&&&&&&&&& { &&&&&&&&&&&&&&&&&&& g.DrawString(kvp.Key, font, xTextBrush, x, Convert.ToInt32(ImgHeight) - xrowHeight); //设置文字内容及输出位置 &&&&&&&&&&&&&&&&&&& x = x + &&&&&&&&&&&&&&& } &&&&&&&&&&&&&&& //y轴 &&&&&&&&&&&&&&& int yspan = 0; &&&&&&&&&&&&&&& int rowHeight = (int)(Math.Ceiling(g.MeasureString("50", font2).Height));//文字的高度 &&&&&&&&&&&&&&& int y = Convert.ToInt32(ImgHeight) - yHeight - rowHeight - pxW &&&&&&&&&&&&&&& yspan = (int)Math.Ceiling((float)(Convert.ToInt32(ImgHeight) - yHeight - pxWidth - (rowHeight + ytopspan)) / (m.Length - 1));//减去rowHeight+20:绘制长度y减去了一个rowheight,此处算yspan时也要减去,另外20是留出y轴最后的文字与顶端的距离。 &&&&&&&&&&&&&&& for (int i = 0; i & m.L i++) &&&&&&&&&&&&&&& { &&&&&&&&&&&&&&&&&&& g.DrawString(m[i].ToString(), font2, yTextBrush, 0, y); //设置文字内容及输出位置 &&&&&&&&&&&&&&&&&&& y = y - &&&&&&&&&&&&&&& } &&&&&&&&&&&&&&& //绘制柱状图. &&&&&&&&&&&&&&& int ximg = xWidth + chartXS//绘制图x轴坐标点 &&&&&&&&&&&&&&& int textwidth = 0;//文字的宽度 &&&&&&&&&&&&&&& int ximgspan = 0;//绘制图形与对应X轴文字对应位置 &&&&&&&&&&&&&&& SolidBrush mybrush = new SolidBrush(chartColor); &&&&&&&&&&&&&&& foreach (KeyValuePair&string, string& kvp in cachede) //绘制x轴柱状图 &&&&&&&&&&&&&&& { &&&&&&&&&&&&&&&&&&& textwidth = (int)(Math.Ceiling(g.MeasureString(kvp.Key, font).Width)); &&&&&&&&&&&&&&&&&&& ximgspan = (int)Math.Ceiling((float)(textwidth - chartWidth) / 2); &&&&&&&&&&&&&&&&&&& //考虑显示最高的百分比数值 &&&&&&&&&&&&&&&&&&& int yRealHeight = (int)Math.Ceiling((float)((Convert.ToInt32(ImgHeight) - yHeight - pxWidth - ytopspan) * 100 * Convert.ToDouble(kvp.Value)) / (100 * getMaxY(m)));//计算柱状图所占高度 &&&&&&&&&&&&&&&&&&& g.FillRectangle(mybrush, ximg + ximgspan, ImgHeight - yHeight - pxWidth - yRealHeight, chartWidth, yRealHeight); &&&&&&&&&&&&&&&&&&& g.DrawString(kvp.Value + "%", chartTextFont, chartTextBrush, ximg + ximgspan - 5, ImgHeight - yHeight - pxWidth - yRealHeight - rowHeight); &&&&&&&&&&&&&&&&&&& ximg = ximg + &&&&&&&&&&&&&&& } &&&&&&&&&&&&&&& //绘制标识 &&&&&&&&&&&&&&& //Font font3 = new System.Drawing.Font("Arial", 10, FontStyle.Regular); &&&&&&&&&&&&&&& //g.DrawRectangle(new Pen(Brushes.Blue), 170, 400, 250, 50); //绘制范围框 &&&&&&&&&&&&&&& //g.FillRectangle(Brushes.Red, 270, 410, 20, 10); //绘制小矩形 &&&&&&&&&&&&&&& //g.DrawString("报名人数", font3, Brushes.Red, 292, 408); &&&&&&&&&&&&&&& //g.FillRectangle(Brushes.Green, 270, 430, 20, 10); &&&&&&&&&&&&&&& //g.DrawString("通过人数", font3, Brushes.Green, 292, 428); &&&&&&&&&&&&&&& System.IO.MemoryStream ms = new System.IO.MemoryStream(); &&&&&&&&&&&&&&& image.Save(ms, System.Drawing.Imaging.ImageFormat.Png); &&&&&&&&&&&&&&& System.Web.HttpContext.Current.Response.ClearContent(); &&&&&&&&&&&&&&& System.Web.HttpContext.Current.Response.ContentType = "image/Png"; &&&&&&&&&&&&&&& System.Web.HttpContext.Current.Response.BinaryWrite(ms.ToArray()); &&&&&&&&&&& } &&&&&&&&&&& finally &&&&&&&&&&& { &&&&&&&&&&&&&&& g.Dispose(); &&&&&&&&&&&&&&& image.Dispose(); &&&&&&&&&&& } &&&&&&& }
&&&您需要以后才能回答,未注册用户请先。怎么用C语言画一个圆形?急~_百度知道
怎么用C语言画一个圆形?急~
#include &graphics.h& main() {int driver,mode,i; float j=1,k=1; driver=VGA;mode=VGAHI; initgraph(&driver,&mode,&&); setbkcolor(YELLOW); for(i=0;i&=25;i++) { setcolor(8); circle(310,250,k); k=k+j; j=j+0.3; } getch(); } 2.//line画直线 #include &graphics.h& main() {int driver,mode,i; float x0,y0,y1,x1; float j=12,k; driver=VGA;mode=VGAHI; initgraph(&driver,&mode,&&); setbkcolor(GREEN); x0=263;y0=263;y1=275;x1=275; for(i=0;i&=18;i++) { setcolor(5); line(x0,y0,x0,y1); x0=x0-5; y0=y0-5; x1=x1+5; y1=y1+5; j=j+10; } x0=263;y1=275;y0=263; for(i=0;i&=20;i++) { setcolor(5); line(x0,y0,x0,y1); x0=x0+5; y0=y0+5; y1=y1-5; } getch(); } 3.//用rectangle画方形 #include &graphics.h& main() {int x0,y0,y1,x1,driver,mode,i; driver=VGA;mode=VGAHI; initgraph(&driver,&mode,&&); setbkcolor(YELLOW); x0=263;y0=263;y1=275;x1=275; for(i=0;i&=18;i++) { setcolor(1); rectangle(x0,y0,x1,y1); x0=x0-5; y0=y0-5; x1=x1+5; y1=y1+5; } settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(150,40,&How beautiful it is!&); line(130,60,480,60); setcolor(2); circle(269,269,137); }
其他类似问题
为您推荐:
*&*圆的左侧*/ &*图形左侧空白控制*/x&lt,2.h&*计算行y对应的列坐标m;x++) printf(&quot#include&lt.5*sqrt(100-y*y); /for(;););=-10;*\); /);x++) printf(&*圆的右侧*&#47.5是屏幕纵横比调节系数因为屏幕的行距大于列距;#include&printf(&for(x=1; /y–){m=2;*图形的空心部分控制*&#47,m; /x&stdio,不进行调节显示出来的将是椭圆*/}return 0; /30-m.h&30+m;for(y=10;printf(&n&y& &int main(){double y
参考资料:
C/C++语言程序百例C/C++语言经典、实用、趣味程序设计编程百例精解
c语言的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁}

我要回帖

更多关于 用c语言画圆的算法 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信