📄 经典c程序100例==61--70.htm
字号:
vp.left;<BR>xcenter = w / 2; /* Determine the
center of circle */<BR>ycenter = h / 2;<BR>radius
= (h - 30) / (AspectRatio * 2);<BR>step = 360 /
MAXPTS; /* Determine # of increments */<BR>angle =
0; /* Begin at zero degrees */<BR>for( i=0 ;
i<MAXPTS ; ++i ){ /* Determine circle
intercepts */<BR>rads = (double)angle * PI /
180.0; /* Convert angle to radians
*/<BR>points[i].x = xcenter + (int)( cos(rads) *
radius );<BR>points[i].y = ycenter - (int)(
sin(rads) * radius * AspectRatio );<BR>angle +=
step; /* Move to next increment */<BR>}<BR>circle(
xcenter, ycenter, radius ); /* Draw bounding
circle */<BR>for( i=0 ; i<MAXPTS ; ++i ){ /*
Draw the cords to the circle */<BR>for( j=i ;
j<MAXPTS ; ++j ){ /* For each remaining
intersect */<BR>moveto(points[i].x, points[i].y);
/* Move to beginning of cord
*/<BR>lineto(points[j].x, points[j].y); /* Draw
the cord */<BR>} } }<BR>main()<BR>{int
driver,mode;<BR>driver=CGA;mode=CGAC0;<BR>initgraph(&driver,&mode,"");<BR>setcolor(3);<BR>setbkcolor(GREEN);<BR>LineToDemo();}<BR>==============================================================<BR><FONT
color=#990000>【程序66】</FONT><BR>题目:输入3个数a,b,c,按大小顺序输出。 <BR>1.程序分析:利用指针方法。<BR>2.程序源代码:<BR>/*pointer*/<BR>main()<BR>{<BR>int
n1,n2,n3;<BR>int
*pointer1,*pointer2,*pointer3;<BR>printf("please
input 3
number:n1,n2,n3:");<BR>scanf("%d,%d,%d",&n1,&n2,&n3);<BR>pointer1=&n1;<BR>pointer2=&n2;<BR>pointer3=&n3;<BR>if(n1>n2)
swap(pointer1,pointer2);<BR>if(n1>n3)
swap(pointer1,pointer3);<BR>if(n2>n3)
swap(pointer2,pointer3);<BR>printf("the sorted
numbers
are:%d,%d,%d\n",n1,n2,n3);<BR>}<BR>swap(p1,p2)<BR>int
*p1,*p2;<BR>{int
p;<BR>p=*p1;*p1=*p2;*p2=p;<BR>}<BR>==============================================================<BR><FONT
color=#990000>【程序67】</FONT><BR>题目:输入数组,最大的与第一个元素交换,最小的与最后一个元素交换,输出数组。<BR>1.程序分析:谭浩强的书中答案有问题。 <BR>2.程序源代码:<BR>main()<BR>{<BR>int
number[10];<BR>input(number);<BR>max_min(number);<BR>output(number);<BR>}<BR>input(number)<BR>int
number[10];<BR>{int
i;<BR>for(i=0;i<9;i++)<BR> scanf("%d,",&number[i]);<BR> scanf("%d",&number[9]);<BR>}<BR>max_min(array)<BR>int
array[10];<BR>{int *max,*min,k,l;<BR>int
*p,*arr_end;<BR>arr_end=array+10;<BR>max=min=array;<BR>for(p=array+1;p<arr_end;p++)<BR> if(*p>*max)
max=p;<BR> else if(*p<*min)
min=p;<BR> k=*max;<BR> l=*min;<BR> *p=array[0];array[0]=l;l=*p;<BR> *p=array[9];array[9]=k;k=*p;<BR> return;<BR>}<BR>output(array)<BR>int
array[10];<BR>{ int
*p;<BR>for(p=array;p<array+9;p++)<BR> printf("%d,",*p);<BR>printf("%d\n",array[9]);<BR>}<BR>==============================================================<BR><FONT
color=#990000>【程序68】</FONT><BR>题目:有n个整数,使其前面各数顺序向后移m个位置,最后m个数变成最前面的m个数<BR>1.程序分析:<BR>2.程序源代码:<BR>main()<BR>{<BR>int
number[20],n,m,i;<BR>printf("the total numbers
is:");<BR>scanf("%d",&n);<BR>printf("back
m:");<BR>scanf("%d",&m);<BR>for(i=0;i<n-1;i++)<BR> scanf("%d,",&number[i]);<BR>scanf("%d",&number[n-1]);<BR>move(number,n,m);<BR>for(i=0;i<n-1;i++)<BR> printf("%d,",number[i]);<BR>printf("%d",number[n-1]);<BR>}<BR>move(array,n,m)<BR>int
n,m,array[20];<BR>{<BR>int
*p,array_end;<BR>array_end=*(array+n-1);<BR>for(p=array+n-1;p>array;p--)<BR> *p=*(p-1);<BR> *array=array_end;<BR> m--;<BR> if(m>0)
move(array,n,m);<BR>}<BR>==============================================================<BR><FONT
color=#990000>【程序69】</FONT><BR>题目:有n个人围成一圈,顺序排号。从第一个人开始报数(从1到3报数),凡报到3的人退出<BR> 圈子,问最后留下的是原来第几号的那位。<BR>1.
程序分析:<BR>2.程序源代码:<BR>#define nmax
50<BR>main()<BR>{<BR>int
i,k,m,n,num[nmax],*p;<BR>printf("please input the
total of
numbers:");<BR>scanf("%d",&n);<BR>p=num;<BR>for(i=0;i<n;i++)<BR> *(p+i)=i+1;<BR> i=0;<BR> k=0;<BR> m=0;<BR> while(m<n-1)<BR> {<BR> if(*(p+i)!=0)
k++;<BR> if(k==3)<BR> {
*(p+i)=0;<BR> k=0;<BR> m++;<BR> }<BR>i++;<BR>if(i==n)
i=0;<BR>}<BR>while(*p==0) p++;<BR>printf("%d is
left\n",*p);<BR>}<BR>==============================================================<BR><FONT
color=#990000>【程序70】</FONT><BR>题目:写一个函数,求一个字符串的长度,在main函数中输入字符串,并输出其长度。 <BR>1.程序分析:<BR>2.程序源代码:<BR>main()<BR>{<BR>int
len;<BR>char *str[20];<BR>printf("please input a
string:\n");<BR>scanf("%s",str);<BR>len=length(str);<BR>printf("the
string has %d
characters.",len);<BR>}<BR>length(p)<BR>char
*p;<BR>{<BR>int
n;<BR>n=0;<BR>while(*p!='\0')<BR>{<BR> n++;<BR> p++;<BR>}<BR>return
n;<BR>}</P>
<P></P>
<P></P></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 borderColorDark=#ffffff cellPadding=0
width=650 align=center bgColor=#d7ebff border=0>
<TBODY>
<TR vAlign=center align=middle bgColor=#3986ef>
<TD id=notice vAlign=center align=left colSpan=2
height=25> <FONT
color=#ffffff><B>[</B>来源<B>]</B>: beck
<B>[</B>编辑<B>]</B>: <FONT color=#ffffff>beck
</FONT> <B>[</B>加入时间<B>]</B>:2002-8-11
</FONT></TD></TR></TBODY></TABLE><BR><BR>
<TABLE width="100%" border=0>
<TBODY>
<TR>
<TD>
<LI><FONT color=#0772b1>上篇文章</FONT>:<A
href="http://www.vcok.com/class/list.asp?id=208">经典c程序100例==51--60</A>
<LI><FONT color=#0772b1>下篇文章</FONT>:<A
href="http://www.vcok.com/class/list.asp?id=210">经典c程序100例==71--80</A>
</LI></TD>
<TD align=right>
<SCRIPT language=JavaScript>
var onecount;
onecount=0;
subcat = new Array();
subcat[0] = new Array("C语言教程","8","35");
subcat[1] = new Array("C技术文章","8","36");
subcat[2] = new Array("C试题库","8","37");
subcat[3] = new Array("C程序百例","8","38");
subcat[4] = new Array("C函数库","8","39");
subcat[5] = new Array("数据结构教程","9","40");
subcat[6] = new Array("常用算法","9","41");
subcat[7] = new Array("在线测试","8","42");
subcat[8] = new Array("linux入门级","10","43");
onecount=9;
function changelocation(locationid)
{
document.myform.Nclassid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.Nclassid.options[document.myform.Nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</SCRIPT>
<FORM name=myform action=ru_query.asp method=post>文章搜索:
<SELECT size=1 name=action> <OPTION value=title
selected>按文章标题搜索</OPTION> <OPTION
value=writer>按文章来源搜索</OPTION> <OPTION
value=content>按文章内容搜索</OPTION> <OPTION
value=Nkey>按照关键词搜索</OPTION></SELECT> <SELECT
onchange=changelocation(document.myform.classid.options[document.myform.classid.selectedIndex].value)
size=1 name=classid> <OPTION value=""
selected>请指定范围</OPTION> <OPTION value=8>C语言教室</OPTION>
<OPTION value=9>数据结构</OPTION> <OPTION
value=10>Linux初探</OPTION></SELECT> <SELECT
name=Nclassid> <OPTION value=""
selected>请指定范围</OPTION> <OPTION value=8>C语言教程</OPTION>
<OPTION value=8>C技术文章</OPTION> <OPTION
value=8>C试题库</OPTION> <OPTION value=8>C程序百例</OPTION>
<OPTION value=8>C函数库</OPTION> <OPTION
value=9>数据结构教程</OPTION> <OPTION value=9>常用算法</OPTION>
<OPTION value=8>在线测试</OPTION> <OPTION
value=10>linux入门级</OPTION></SELECT> <INPUT maxLength=50
size=10 value=输入关键字 name=keyword> <INPUT type=submit value=搜索 name=Submit>
</FORM></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD width="50%" bgColor=#e6e6e6>□- C程序百例热点文章</TD>
<TD width="50%" bgColor=#e6e6e6>□- 相关文章</TD></TR>
<TR>
<TD vAlign=top width="50%" bgColor=#ffffff>1.<A
title=经典c程序100例==91--100
href="http://www.vcok.com/class/list.asp?id=212" target=_top>
经典c程序100例==91--100 </A>[阅读:<FONT
color=red>54281</FONT>]<BR>2.<A title=经典c程序100例==1--10
href="http://www.vcok.com/class/list.asp?id=203" target=_top>
经典c程序100例==1--10 </A>[阅读:<FONT color=red>35286</FONT>]<BR>3.<A
title=经典c程序100例==51--60
href="http://www.vcok.com/class/list.asp?id=208" target=_top>
经典c程序100例==51--60 </A>[阅读:<FONT
color=red>26796</FONT>]<BR>4.<A title="经典c程序100例==11--20 "
href="http://www.vcok.com/class/list.asp?id=204" target=_top>
经典c程序100例==11--20 </A>[阅读:<FONT
color=red>25227</FONT>]<BR>5.<A title="经典c程序100例==81--90 "
href="http://www.vcok.com/class/list.asp?id=211" target=_top>
经典c程序100例==81--90 </A>[阅读:<FONT color=red>23814</FONT>]<BR></TD>
<TD vAlign=top width="50%" bgColor=#ffffff><A
href="http://www.vcok.com/class/list.asp?id=212">经典c程序100例==91--100</A><BR><A
href="http://www.vcok.com/class/list.asp?id=211">经典c程序100例==81--90
</A><BR><A
href="http://www.vcok.com/class/list.asp?id=210">经典c程序100例==71--80</A><BR><A
href="http://www.vcok.com/class/list.asp?id=209">经典c程序100例==61--70</A><BR><A
href="http://www.vcok.com/class/list.asp?id=208">经典c程序100例==51--60</A><BR></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<DIV></DIV>
<TABLE width=778 bgColor=#ffffff border=0>
<TBODY>
<TR bgColor=#ffffff>
<TD colSpan=3></TD></TR>
<TR vAlign=baseline>
<TD colSpan=3>
<HR noShade SIZE=1>
</TD></TR>
<TR>
<TD width="7%"> </TD>
<TD width="87%">
<DIV align=center>唯C世界|<FONT
face="Arial, Helvetica, sans-serif">http://wWw.VcOk.Com</FONT> <FONT
face="Arial, Helvetica, sans-serif">Ver 1.00 Design By <FONT
face="Verdana, Arial, Helvetica, sans-serif"><B><FONT
color=#ff0000><A href="http://www.vcok.com/"><FONT
color=#ff0009>VcOk.com</FONT></A></FONT></B></FONT></FONT></FONT></DIV></TD>
<TD width="6%"> </TD></TR>
<TR>
<TD width="7%"> </TD>
<TD width="87%">
<DIV align=center><FONT
face="Arial, Helvetica, sans-serif">CopyRight <FONT
color=#ff0000>©</FONT> .:.:.:2002-2008 AT Tie Ling Liaoning
China:.:.:.</FONT></DIV></TD>
<TD width="6%"> </TD></TR>
<TR>
<TD width="7%"> </TD>
<TD align=middle width="87%"> 辽宁省铁岭师专微机室
<U>杨志锋</U> 数学系 <U>杜博</U> </TD>
<TD width="6%"> </TD></TR></TBODY></TABLE></TR></TBODY></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -