某公司管理流程图(英文版).pptx

上传人:修**** 文档编号:85119715 上传时间:2023-04-10 格式:PPTX 页数:22 大小:129.59KB
返回 下载 相关 举报
某公司管理流程图(英文版).pptx_第1页
第1页 / 共22页
某公司管理流程图(英文版).pptx_第2页
第2页 / 共22页
点击查看更多>>
资源描述

《某公司管理流程图(英文版).pptx》由会员分享,可在线阅读,更多相关《某公司管理流程图(英文版).pptx(22页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、Ch5 Selection StatementsProgramming ConstructProgramming Construct1)We divide the basic programming construct into three types:Sequential Structure 、Selection Structure and Loop Structure.2)Flow Chart(流程图):is a graphical representation in which specific symbols and necessary letters are used to desc

2、ribe the steps.3)The flow chart about the three basic programming construct is as follows:ABconditionABconditionASequential structureSelection StructureSelection Structure1、relation operator andrelation expression 2、logical operators and logical expression3、if statements4、switch statements5、examples

3、Chapter OutlineThree forms:(1)if(expression)statements(2)if(expression)statements1elsestatements2(3)if(expression1)statements1elseif(expression2)statements2elseif(expression3)statements3elseif(expressionm)statementsmelsestatementsnexexex第第五五章章选选择择结结构构If语语句句的的形形式式Brief Summary Forme1:if(expression)st

4、atementsexpressionstatementsF(0)T(not0)ex:if(xy)printf(“%d”,x);Firstly,solvetheexpression.Ifthevalueoftheexpressionisnotzero,thenthecorrespondingststementsequenceisexcuted.Ifnoneoftheexpressionisfalse,thenexcutethestatementsafterifderectly.第第五五章章选选择择结结构构If语语句句的的形形式式exampleexpressionstatements1statem

5、ents2TFex:if(xy)printf(“%d”,x);elseprintf(“%d”,y);Form2:if(expression)statements1elsestatements2第第五五章章选选择择结结构构If语语句句的的形形式式exampleexpression1expression2expression3expression4statements1 statements2statements3statements4 statements5FFFFTTTTex:if(number500)cost=0.15;elseif(number300)cost=0.10;elseif(nu

6、mber100)cost=0.075;elseif(number50)cost=0.05;elsecost=0;Form3:nested-if statements第第五五章章选选择择结结构构If语语句句的的形形式式example(1)Theexpressionofthreeformsbehindif-statementsalwaysislogicalorrelationexpression.DCL of three if-statements forms:(2)Inform2andforme3,thereisasemicoloninfrontofelse,alsointheendofalls

7、tatements.(3)Behindiforelse,itmayincludeonlyoneoperatestatements,alsoincludemanystatements,butshouldbedrawedtogetherwithbrace.()第第五五章章选选择择结结构构If语语句句的的形形式式Ex:#include main()int x,y;scanf(“%d,%d”,&x,&y);if(xy)x=y;y=x;else x+;y+;printf(“%d,%dn”,x,y);Compile Error!ex:if(a+ba&c+ab)s=0.5*(a+b+c);area=sqrt

8、(s*(s-a)*(s-b)*(s-c);printf(“area=%6.sf”,area);elseprintf(“itisnotatrilateral”);Notice:Thebrace(“”)souterfaceneednotsemicolon。Becauseinthebrace()thereisafullcompoundstatement.第第五五章章选选择择结结构构If语语句句的的形形式式 original program:main()floata,b,t;scanf(“%f,%f”,&a,&b);if(ab)t=a;a=b;b=t;printf(“%5.2f,%5.2f”,a,b)

9、;ex1:Input twe real numbers,please output there numbers according to the order of little to big.Need three float variables:a,b,t第第五五章章选选择择结结构构If语语句句举举例例ex2:Input three real numbers,please output there numbers according to the order of little to big.original program:main()floata,b,c,t;scanf(“%f,%f,%f

10、”,&a,&b,&c);if(ab)t=a;a=b;b=t;if(ac)t=a;a=c;c=t;if(bc)t=b;b=c;c=t;printf(“%5.2f,%5.2f,%5.2f”,a,b,c);第第五五章章选选择择结结构构If语语句句举举例例Return#include main()int a,b;printf(Enter integer a:);scanf(%d,&a);printf(Enter integer b:);scanf(%d,&b);if(a=b)printf(a=bn);else printf(a!=bn);ex3:Iputtwonumbers,decidethemtob

11、eequallyornot.Result:Enter integer a:12 Enter integer b:12 a=b Result:Enter integer a:12 Enter integer b:9 a!=b 第第五五章章选选择择结结构构If语语句句嵌嵌套套举举例例ReturnGeneralform:expression1?expression2:expression3 Condition operator commands three operate objects,it is a operator alonely in C language.ex:max=(ab)?a:b;E

12、qual to:if(ab)max=a;elsemax=b;第第五五章章选选择择结结构构条条件件运运算算符符Condition operator DCL:(1)Executionorder:Firstly,solve the expression 1,If the value is ture,then solve the expression 2,this moment here is the value of whole expressions.If the value is false,then solve the expression 3,this moment here is the

13、value of whole expressions.ex:max=(ab)?a:b;If a=3,b=4;max=4;If a=6,b=4;max=6;第第五五章章选选择择结结构构条条件件运运算算符符(2)Condition operator overmatch assigned operator,but under relation and arithmetic operator.(3)Condition operators combined direcion is from right to left.ex1:max=(ab)?a:b;max=ab?a:b;ex2:max=ab?a:b+

14、1;max=ab?a:(b+1);ex3:max=ab?a:cd?c:d;max=ab?a:(cd?c:d);Suppose a=1,b=2,c=3,d=4第第五五章章选选择择结结构构条条件件运运算算符符(4)Condition operator cannt replce ordinary if-statements,only when the embed statements in it is assigned statements(and two branches assign to the same variable).ex:if(ab)printf(“%d”,a);elseprintf

15、(“%d”,b);printf(“%d”,ab?a:b);(5)Thetypeofexpression1andexpression2canbesame,alsobedifferent.ex:intx;x?a:b;ex:xy?1:1.5;第第五五章章选选择择结结构构条条件件运运算算符符Ex5:Input a letter,iudge it is a capital letter or not ,if is,then change it to lower-case letter;if not,then nothing changed。Finally,output this letter。main(

16、)charch;scanf(“%c“,&ch);ch=(ch=A&ch=Z)?(ch+32):ch;printf(“%c“,ch);第第五五章章选选择择结结构构条条件件运运算算符符Returnex6:Function-1(x0)y=Writeaprogramme,inputthevalueofx.Thenouputy.main()float x;int y;scanf(“%f”,&x);if(x 0)y=1;printf(“n%f,%d”,x,y);第第五五章章选选择择结结构构If语语句句嵌嵌套套举举例例ReturnAlgorithm 2 2:input x input x ifx0 y=-1

17、 ifx0 y=1 ifx0 y=1 output y output yAlgorithm 3:inputxifx0y=-1else:ifx=0y=0else:y=1ouputy第第五五章章选选择择结结构构If语语句句嵌嵌套套举举例例p1:main()floatx;inty;scanf(“%f”,&x);if(x=0)if(x0)y=1;elsey=0;elsey=-1;p3:modifyto:y=-1;if(x!=0)if(x0)y=1;elsey=0;p4:modifyto:y=0;if(x=0)if(x0)y=1;elsey=-1;第第五五章章选选择择结结构构If语语句句嵌嵌套套举举例例Return#include main()int x,y;printf(Enter an integer:);scanf(%d,&x);y=x;if(yabsolute value:%dn,x,y);ex运行:Enter an integer:-12 integer:-12-absolute value:12第第五五章章选选择择结结构构If语语句句嵌嵌套套举举例例

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 管理文献 > 企业管理

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com