if else 和 if if 的区别if (ch == ' ')sp_ct++;else if (ch == '\n')nl_ct++;elseother++;和if (ch == ' ')sp_ct++;if (ch == '\n')nl_ct++;elseother++;这两个有什么区别

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/17 23:54:39
if else 和 if if 的区别if (ch == ' ')sp_ct++;else if (ch == '\n')nl_ct++;elseother++;和if (ch == ' ')sp_ct++;if (ch == '\n')nl_ct++;elseother++;这两个有什么区别
x)LSH)NUx:GZzڱHPUPWP,.O.ֶFSAd@@g>ٱɎUt>dgE6IE\ G,%pU`M`N x/ql><:O?ٽɎޗs^,k?d';_]g>_tO?#PZzf͓ `y>M_6-: XO7lEާSb@s >x-v{>:u6yv(rR

if else 和 if if 的区别if (ch == ' ')sp_ct++;else if (ch == '\n')nl_ct++;elseother++;和if (ch == ' ')sp_ct++;if (ch == '\n')nl_ct++;elseother++;这两个有什么区别
if else 和 if if 的区别
if (ch == ' ')
sp_ct++;
else if (ch == '\n')
nl_ct++;
else
other++;

if (ch == ' ')
sp_ct++;
if (ch == '\n')
nl_ct++;
else
other++;
这两个有什么区别

if else 和 if if 的区别if (ch == ' ')sp_ct++;else if (ch == '\n')nl_ct++;elseother++;和if (ch == ' ')sp_ct++;if (ch == '\n')nl_ct++;elseother++;这两个有什么区别
if else是语法块,可以不需要else.
故你下面的这段程式是2个if else语法块,只是第一个if的else没有而已.
那么这两段就不能单看你说的这个区别了~
要分块理解,OK~?