正在加载图片...
The C Programming language Chapter 5 Control Flow 口 if-else association associates the else with the closest previous main( {mntx=100a=10.b=20 Ion int1=5ⅴ2=0: if(a<b) f(b!=15) if(!v1)1 else if(v2)x=10 X=-1: printf( x=%/od,, x)The C Programming Language Chapter 5 Control Flow ❑ if-else association: ➢ associates the else with the closest previous else-less if if(……) if(……) if(……) else…... else…... else…... as: if (a= =b) if (b= =c) printf(“a= =b= =c”); else printf(“a!=b”); ➢ Uses braces { } to force the proper association main() { int x=100,a=10,b=20; int v1=5,v2=0; if (a<b) if (b!=15) if (!v1) x=1; else if(v2) x=10; x=-1; printf(“x=%d”,x); } x=-1
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有