📄 3.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0053)http://www.hificat.com/study/c%20lesson/lesson8_3.htm -->
<HTML><HEAD><TITLE>杭州电子&计算机工作室 欢迎您! Welcome to HangZhou Electron & Computer Studio</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<STYLE type=text/css>A:link {
COLOR: #3366cc; TEXT-DECORATION: none
}
A:visited {
COLOR: #3366cc; TEXT-DECORATION: none
}
A:active {
COLOR: #3366cc; TEXT-DECORATION: none
}
A:hover {
COLOR: #3366cc; TEXT-DECORATION: underline
}
TD {
FONT-SIZE: 9pt; COLOR: #3366cc; FONT-FAMILY: "宋体"; TEXT-DECORATION: none
}
A {
FONT-SIZE: 9pt; COLOR: #3366cc; FONT-FAMILY: "宋体"; TEXT-DECORATION: none
}
.A {
FONT-SIZE: 9pt; COLOR: #3366cc; FONT-FAMILY: "宋体"; TEXT-DECORATION: none
}
.coast {
LINE-HEIGHT: 180%
}
.coast1 {
LINE-HEIGHT: 120%
}
.unnamed1 {
BORDER-RIGHT: #e0fdfe thin dotted; BORDER-TOP: #0099ff thin dotted; BORDER-LEFT: #0099ff thin dotted; BORDER-BOTTOM: #ffffff thin dotted
}
.unnamed2 {
BORDER-RIGHT: #e2fcfe thin dotted; BORDER-TOP: #0099ff thin dotted; BORDER-LEFT: #0099ff thin dotted; BORDER-BOTTOM: #ffffff thin dotted
}
.unnamed3 {
BORDER-RIGHT: #ffffff; BORDER-TOP: #0099ff thin; BORDER-LEFT: #ffffff thin; BORDER-BOTTOM: #0099ff
}
.unnamed4 {
BORDER-TOP-WIDTH: thick; BORDER-LEFT-WIDTH: thick; BORDER-LEFT-COLOR: #0099ff; BORDER-BOTTOM-WIDTH: thick; BORDER-BOTTOM-COLOR: #ffffff; BORDER-TOP-COLOR: #0099ff; BORDER-RIGHT-WIDTH: thick; BORDER-RIGHT-COLOR: #ffffff
}
.style1 {
FONT-SIZE: 12pt
}
</STYLE>
<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#def6ff
background=3.files/background_content_neu.gif>
<TABLE height=130 cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR vAlign=top>
<TD width=790 background=3.files/main-top.jpg height=140>
<TABLE cellSpacing=0 cellPadding=0 width=760 border=0>
<TBODY>
<TR>
<TD width=313 rowSpan=2><IMG height=1 src="3.files/1x1.gif"
width=1></TD>
<TD vAlign=bottom><IMG height=52 src="3.files/title1.jpg"
width=454></TD></TR>
<TR>
<TD vAlign=bottom> </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE height=167 cellSpacing=0 cellPadding=0 width=757 border=0>
<TBODY>
<TR>
<TD width=1 height=200> </TD>
<TD vAlign=top align=left width=756 height=200>
<TABLE cellSpacing=0 cellPadding=0 width="757%" border=0>
<TBODY>
<TR vAlign=top align=left>
<TD width=10 height=5><IMG height=11
src="3.files/kartei_oben_links.gif" width=10></TD>
<TD width=595 height=5><IMG height=11
src="3.files/kartei_oben_mitte.gif" width=399></TD>
<TD width=151 height=5> </TD></TR>
<TR vAlign=top align=left>
<TD width=10 bgColor=#0099ff height=10><IMG height=17
src="3.files/kartei_links.jpg" width=10></TD>
<TD class=textKlein vAlign=center align=left width=595 bgColor=#0099ff
height=10><B><FONT color=#ffffff>首页</FONT><FONT color=#ffffff>>
单片机教学(C语言教程)</FONT></B></TD>
<TD width=151 bgColor=#0099ff height=10> </TD></TR></TBODY></TABLE>
<TABLE cellSpacing=2 cellPadding=2 width="100%" border=0>
<TBODY>
<TR>
<TD>
<DIV class=title1 align=center
style1><STRONG>第八课 语 句(3)-条件语句</STRONG></DIV></TD></TR>
<TR>
<TD> 看到题目后相信大家都会大概对条件语句这个概念有所认识。是的,就如学习语文中的条件语句一样,C语言也一样是"如果XX就XX"或是"如果XX就XX否则XX"。也就是当条件符合时就执行语句。条件语句又被称为分支语句,其关键字是由if构成。C语言提供了3种形式的条件语句:<BR>1:
if (条件表达式) 语句<BR>当条件表达式的结果为真时,就执行语句,否则就跳过。<BR>如 if (a==b) a++;
当a等于b时,a就加1
<P>2: if (条件表达式) 语句1<BR>else 语句2<BR>当条件表达式成立时,就执行语句1,否则就执行语句2<BR>如
if (a==b)<BR>a++;<BR>else <BR>a--;<BR>当a等于b时,a加1,否则a-1。</P>
<P>3:if (条件表达式1) 语句1<BR>else if (条件表达式2) 语句2<BR>else if (条件表达式3)
语句3<BR>else if (条件表达式m) 语句n<BR>else 语句m<BR> 这是由if
else语句组成的嵌套,用来实现多方向条件分支,使用时因注意if和else的配对使用,要是少了一个就会语法出错,记住else总是与最临近的if相配对。</P>
<P></P>
<P></P><BR></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE class=coast cellSpacing=0 cellPadding=0 width=736 border=0>
<TBODY>
<TR>
<TD align=middle>
<DIV align=center>联系地址:浙江省杭州市拱北小区永和坊9幢504室 徐玮
邮政编码:310015<BR>Email:xu169@sina.com QQ:12739176 联系电话:0571-85956028(小灵通)
手机:13185018567(短信)<BR>杭州电子&计算机工作室 版权所有 <BR>COPYRIGHT2003 HangZhou
Electron&Computer Studio. All rights reserved
</DIV></TD></TR></TBODY></TABLE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -