📄 经典c程序100例==41--50.htm
字号:
tmp=0;<BR>for(i=1;i<=100;i++)<BR>tmp+=i;<BR>printf("The
sum is
%d\n",tmp);<BR>}<BR>==============================================================<BR><FONT
color=#990000>【程序46】</FONT><BR>题目:宏#define命令练习(1) <BR>1.程序分析:<BR>2.程序源代码:<BR>#include
"stdio.h"<BR>#define TRUE 1<BR>#define FALSE
0<BR>#define SQ(x) (x)*(x)<BR>void
main()<BR>{<BR>int num;<BR>int
again=1;<BR>printf("\40: Program will stop if
input value less than
50.\n");<BR>while(again)<BR>{<BR>printf("\40:Please
input
number==>");<BR>scanf("%d",&num);<BR>printf("\40:The
square for this number is %d
\n",SQ(num));<BR>if(num>=50)<BR> again=TRUE;<BR>else<BR> again=FALSE;<BR>}<BR>}<BR>==============================================================<BR><FONT
color=#990000>【程序47】</FONT><BR>题目:宏#define命令练习(2)<BR>1.程序分析: <BR>2.程序源代码:<BR>#include
"stdio.h"<BR>#define exchange(a,b) { \
/*宏定义中允许包含两道衣裳命令的情形,此时必须在最右边加上"\"*/<BR> int
t;\<BR> t=a;\<BR> a=b;\<BR> b=t;\<BR> }<BR>void
main(void)<BR>{<BR>int x=10;<BR>int
y=20;<BR>printf("x=%d;
y=%d\n",x,y);<BR>exchange(x,y);<BR>printf("x=%d;
y=%d\n",x,y);<BR>}<BR>==============================================================<BR><FONT
color=#990000>【程序48】</FONT><BR>题目:宏#define命令练习(3) <BR>1.程序分析:<BR>2.程序源代码:<BR>#define
LAG ><BR>#define SMA <<BR>#define EQ
==<BR>#include "stdio.h"<BR>void main()<BR>{ int
i=10;<BR>int j=20;<BR>if(i LAG j)<BR>printf("\40:
%d larger than %d \n",i,j);<BR>else if(i EQ
j)<BR>printf("\40: %d equal to %d
\n",i,j);<BR>else if(i SMA j)<BR>printf("\40:%d
smaller than %d \n",i,j);<BR>else<BR>printf("\40:
No such
value.\n");<BR>}<BR>==============================================================<BR><FONT
color=#990000>【程序49】</FONT><BR>题目:#if
#ifdef和#ifndef的综合应用。<BR>1. 程序分析:
<BR>2.程序源代码:<BR>#include "stdio.h"<BR>#define
MAX<BR>#define MAXIMUM(x,y)
(x>y)?x:y<BR>#define MINIMUM(x,y)
(x>y)?y:x<BR>void main()<BR>{ int
a=10,b=20;<BR>#ifdef MAX<BR>printf("\40: The
larger one is
%d\n",MAXIMUM(a,b));<BR>#else<BR>printf("\40: The
lower one is
%d\n",MINIMUM(a,b));<BR>#endif<BR>#ifndef
MIN<BR>printf("\40: The lower one is
%d\n",MINIMUM(a,b));<BR>#else<BR>printf("\40: The
larger one is
%d\n",MAXIMUM(a,b));<BR>#endif<BR>#undef
MAX<BR>#ifdef MAX<BR>printf("\40: The larger one
is %d\n",MAXIMUM(a,b));<BR>#else<BR>printf("\40:
The lower one is
%d\n",MINIMUM(a,b));<BR>#endif<BR>#define
MIN<BR>#ifndef MIN<BR>printf("\40: The lower one
is %d\n",MINIMUM(a,b));<BR>#else<BR>printf("\40:
The larger one is
%d\n",MAXIMUM(a,b));<BR>#endif<BR>}<BR>==============================================================<BR><FONT
color=#990000>【程序50】</FONT><BR>题目:#include
的应用练习 <BR>1.程序分析:<BR>2.程序源代码:<BR>test.h
文件如下:<BR>#define LAG ><BR>#define SMA
<<BR>#define EQ ==<BR>#include "test.h"
/*一个新文件50.c,包含test.h*/<BR>#include
"stdio.h"<BR>void main()<BR>{ int i=10;<BR>int
j=20;<BR>if(i LAG j)<BR>printf("\40: %d larger
than %d \n",i,j);<BR>else if(i EQ
j)<BR>printf("\40: %d equal to %d
\n",i,j);<BR>else if(i SMA j)<BR>printf("\40:%d
smaller than %d \n",i,j);<BR>else<BR>printf("\40:
No such value.\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=206">经典c程序100例==31--40</A>
<LI><FONT color=#0772b1>下篇文章</FONT>:<A
href="http://www.vcok.com/class/list.asp?id=208">经典c程序100例==51--60</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>26795</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 + -