📄 经典c程序100例==61--70.htm
字号:
function hidemenuie5() {
ie5menu.style.visibility = "hidden";
}
function highlightie5() {
if (event.srcElement.className == "menuitems") {
event.srcElement.style.backgroundColor = "highlight";
event.srcElement.style.color = "white";
if (display_url)
window.status = event.srcElement.url;
}
}
function lowlightie5() {
if (event.srcElement.className == "menuitems") {
event.srcElement.style.backgroundColor = "";
event.srcElement.style.color = "black";
window.status = "";
}
}
function jumptoie5() {
if (event.srcElement.className == "menuitems") {
if (event.srcElement.getAttribute("target") != null)
window.open(event.srcElement.url, event.srcElement.getAttribute("target"));
else
window.location = event.srcElement.url;
}
}
// End -->
</SCRIPT>
<SCRIPT language=JavaScript>
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</SCRIPT>
<DIV id=Layer1
style="Z-INDEX: 1; LEFT: 484px; VISIBILITY: hidden; WIDTH: 146px; POSITION: absolute; TOP: 68px; HEIGHT: 24px">
<TABLE height=24 cellSpacing=0 cellPadding=1 width="100%"
bgColor=#000000 border=0>
<TBODY>
<TR>
<TD>
<TABLE height=24 cellSpacing=0 cellPadding=0
width="100%" bgColor=#ffffe6 border=0>
<TBODY>
<TR>
<TD
class=zi>点击“保存设置”按扭可使您本次阅读的整体设置(文字、字号、背景)得以保留,下次阅读时您就不必再重新设置,以符合您的阅读习惯。</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV>
<DIV id=Layer2
style="Z-INDEX: 2; LEFT: 644px; WIDTH: 19px; POSITION: absolute; TOP: 6px; HEIGHT: 14px"> </DIV>
<TABLE cellSpacing=0 cellPadding=0 width=650 align=center>
<TBODY>
<TR vAlign=center align=left>
<TD vAlign=top width=650
background=经典c程序100例==61--70.files/titleback.png colSpan=2
height=22>
<TABLE cellSpacing=2 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>
<TD vAlign=top width=40> </TD>
<TD class=zi vAlign=center width=562><B><FONT
color=#ffffff>.:.:经典c程序100例==61--70:.:.</FONT></B></TD>
<TD class=zi vAlign=top width=18> </TD>
<TD vAlign=center width=16><A title=关闭窗口
href="javascript:window.close();"><IMG height=19
src="经典c程序100例==61--70.files/close.png" width=19
border=0></A></TD></TR></TBODY></TABLE></TD></TR>
<TR vAlign=center align=left>
<TD vAlign=top bgColor=#bdcff7 colSpan=2 height=24>
<TABLE cellSpacing=0 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>
<TD width=1></TD>
<TD align=right width=24><A
onmouseover="MM_swapImage('Image5','','images/home2.png',1)"
onmouseout=MM_swapImgRestore()
href="http://www.ie586.net/"><IMG title=返回页面
height=22 src="经典c程序100例==61--70.files/home.png"
width=24 border=0 name=Image5></A></TD>
<TD align=right width=24><A
onmouseover="MM_swapImage('Image4','','images/re_write2.gif',1)"
onmouseout=MM_swapImgRestore()
href="http://210.76.63.207/lb5000/leoboard.cgi"><IMG
title=发表评论 height=19
src="经典c程序100例==61--70.files/re_write.gif"
width=20 border=0 name=Image4></A></TD>
<TD width=24>
<DIV align=center><A
onclick="window.print();return false"
href="http://www.vcok.com/class/list.asp?id=209#"><IMG
onmouseover="MM_swapImage('p','','images/print2.png',1)"
height=22 alt=打印文档
src="经典c程序100例==61--70.files/print.png" width=24
border=0 name=p></A></DIV></TD>
<TD width=2></TD>
<TD class=zi vAlign=center width=308
height=25><FONT size=2> 文字 <SELECT
style="WIDTH: 60px; HEIGHT: 20px; fontsize: 9pt"
onchange=setFontColor(this.value);
name=seltextcolor> <OPTION value=#000000
selected>黑色</OPTION> <OPTION
value=#FFFFFF>白色</OPTION> <OPTION
value=#FF0000>红色</OPTION> <OPTION
value=#555555>灰色</OPTION> <OPTION
value=#00FF00>绿色</OPTION> <OPTION
value=#0000FF>蓝色</OPTION> <OPTION
value=#00cccc>青色</OPTION> <OPTION
value=#ffff00>黄色</OPTION></SELECT> 背景 <SELECT
style="WIDTH: 60px; HEIGHT: 20px; fontsize: 9pt"
onchange=setBgColor(this.value); name=selbkcolor>
<OPTION value=#FFFFFF selected>白色</OPTION>
<OPTION value=#000000>黑色</OPTION> <OPTION
value=#FFCCFF>粉红</OPTION> <OPTION
value=#CCCCCC>灰色</OPTION> <OPTION
value=#CCFFCC>绿色</OPTION> <OPTION
value=#99CCFF>蓝色</OPTION> <OPTION
value=#CCFFFF>青色</OPTION> <OPTION
value=#FFCCCC>综色</OPTION></SELECT> 字号 <SELECT
style="WIDTH: 60px; HEIGHT: 20px; fontsize: 9pt"
onchange=setFontSize(this.value);
name=selfontsize> <OPTION value=9pt selected>9
pt</OPTION> <OPTION value=10pt>10 pt</OPTION>
<OPTION value=12pt>12 pt</OPTION> <OPTION
value=14pt>14 pt</OPTION> <OPTION value=16pt>16
pt</OPTION> <OPTION value=19pt>19
pt</OPTION></SELECT> </FONT></TD>
<TD class=zi width=85><FONT size=2><A
onmouseover="MM_showHideLayers('Layer1','','show')"
onmouseout="MM_showHideLayers('Layer1','','hide')"
href="javascript:saveit();"><IMG
onmouseover="MM_swapImage('s','','images/save2.png',1)"
height=22 src="经典c程序100例==61--70.files/save.png"
width=23 align=absBottom border=0
name=s></A>保存设置</FONT></TD>
<TD class=zi width=2><FONT size=2> </FONT></TD>
<TD class=zi width=164><FONT
size=2> 人气指数:<FONT
color=#ff0000>14088</FONT>
</FONT></TD></TR></TBODY></TABLE></TD></TR>
<TR vAlign=center align=left>
<TD bgColor=#bdcff7 colSpan=2 height=370>
<TABLE height=360 cellSpacing=0 borderColorDark=#4275d6
cellPadding=5 width=640 align=center bgColor=#ffffff
borderColorLight=#ffffff border=1>
<TBODY>
<TR vAlign=top align=left>
<TD id=thetd style="FONT-SIZE: 10pt">
<DIV style="WIDTH: 626px; HEIGHT: 132px"
align=left>
<P align=left>
<STYLE type=text/css>TD {
FONT-SIZE: 9pt
}
BODY {
FONT-SIZE: 9pt; COLOR: #000000; LINE-HEIGHT: 150%
}
A:link {
COLOR: #000000; TEXT-DECORATION: none
}
A:visited {
COLOR: #000000; TEXT-DECORATION: none
}
A:active {
COLOR: #000000; TEXT-DECORATION: none
}
A:hover {
COLOR: #ff0000; TEXT-DECORATION: underline
}
</STYLE>
<P><FONT color=#ff9933><B><FONT size=5> <FONT
color=#3300cc>经典c程序100例==61--70</FONT></FONT></B></FONT></P>
<P><FONT
color=#990000>【程序61】</FONT><BR>题目:打印出杨辉三角形(要求打印出10行如下图) <BR>1.程序分析:<BR>
1<BR> 1 1<BR> 1 2 1<BR> 1 3
3 1<BR> 1 4 6 4 1<BR> 1 5
10 10 5 1 <BR>2.程序源代码:<BR>main()<BR>{int
i,j;<BR>int
a[10][10];<BR>printf("\n");<BR>for(i=0;i<10;i++)<BR> {a[i][0]=1;<BR> a[i][i]=1;}<BR>for(i=2;i<10;i++)<BR> for(j=1;j<i;j++)<BR> a[i][j]=a[i-1][j-1]+a[i-1][j];<BR>for(i=0;i<10;i++)<BR> {for(j=0;j<=i;j++)<BR> printf("%5d",a[i][j]);<BR> printf("\n");<BR> }<BR>}<BR>==============================================================<BR><FONT
color=#990000>【程序62】</FONT><BR>题目:学习putpixel画点。<BR>1.程序分析: <BR>2.程序源代码:<BR>#include
"stdio.h"<BR>#include
"graphics.h"<BR>main()<BR>{<BR>int
i,j,driver=VGA,mode=VGAHI;<BR>initgraph(&driver,&mode,"");<BR>setbkcolor(YELLOW);<BR>for(i=50;i<=230;i+=20)<BR> for(j=50;j<=230;j++)<BR> putpixel(i,j,1);<BR>for(j=50;j<=230;j+=20)<BR> for(i=50;i<=230;i++)<BR> putpixel(i,j,1);<BR>}<BR>==============================================================<BR><FONT
color=#990000>【程序63】</FONT><BR>题目:画椭圆ellipse <BR>1.程序分析:<BR>2.程序源代码:<BR>#include
"stdio.h"<BR>#include "graphics.h"<BR>#include
"conio.h"<BR>main()<BR>{<BR>int
x=360,y=160,driver=VGA,mode=VGAHI;<BR>int
num=20,i;<BR>int
top,bottom;<BR>initgraph(&driver,&mode,"");<BR>top=y-30;<BR>bottom=y-30;<BR>for(i=0;i<num;i++)<BR>{<BR>ellipse(250,250,0,360,top,bottom);<BR>top-=5;<BR>bottom+=5;<BR>}<BR>getch();<BR>}<BR>==============================================================<BR><FONT
color=#990000>【程序64】</FONT><BR>题目:利用ellipse and
rectangle 画图。<BR>1.程序分析:<BR>2.程序源代码:<BR>#include
"stdio.h"<BR>#include "graphics.h"<BR>#include
"conio.h"<BR>main()<BR>{<BR>int
driver=VGA,mode=VGAHI;<BR>int
i,num=15,top=50;<BR>int
left=20,right=50;<BR>initgraph(&driver,&mode,"");<BR>for(i=0;i<num;i++)<BR>{<BR>ellipse(250,250,0,360,right,left);<BR>ellipse(250,250,0,360,20,top);<BR>rectangle(20-2*i,20-2*i,10*(i+2),10*(i+2));<BR>right+=5;<BR>left+=5;<BR>top+=10;<BR>}<BR>getch();<BR>}<BR>==============================================================<BR><FONT
color=#990000>【程序65】</FONT><BR>题目:一个最优美的图案。 <BR>1.程序分析:<BR>2.程序源代码:<BR>#include
"graphics.h"<BR>#include "math.h"<BR>#include
"dos.h"<BR>#include "conio.h"<BR>#include
"stdlib.h"<BR>#include "stdio.h"<BR>#include
"stdarg.h"<BR>#define MAXPTS 15<BR>#define PI
3.1415926<BR>struct PTS {<BR>int
x,y;<BR>};<BR>double AspectRatio=0.85;<BR>void
LineToDemo(void)<BR>{<BR>struct viewporttype
vp;<BR>struct PTS points[MAXPTS];<BR>int i, j, h,
w, xcenter, ycenter;<BR>int radius, angle,
step;<BR>double rads;<BR>printf(" MoveTo / LineTo
Demonstration" );<BR>getviewsettings( &vp
);<BR>h = vp.bottom - vp.top;<BR>w = vp.right -
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -