欢迎来到第一文库网! | 帮助中心 第一文库网-每个人都是第一
第一文库网
全部分类
  • 研究报告>
  • 学术论文>
  • 全科教育>
  • 应用文档>
  • 行业资料>
  • 企业管理>
  • 技术资料>
  • 生活休闲>
  • ImageVerifierCode 换一换
    首页 第一文库网 > 资源分类 > PPT文档下载
    分享到微信 分享到微博 分享到QQ空间

    表格模板-Chart流程图is 精品.ppt

    • 资源ID:13468       资源大小:586KB        全文页数:23页
    • 资源格式: PPT        下载积分:3金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: QQ登录 微博登录
    二维码
    扫码关注公众号登录
    下载资源需要3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    表格模板-Chart流程图is 精品.ppt

    Programming 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 describe the steps.3)The flow chart about the three basic programming construct is as follows:ABconditionABconditionASequential structureSelection StructureSelection Structure1、relation operator and relation expression 2、logical operators and logical expression3、if statements4、 switch statements5、 examplesChapter OutlineThree forms: (1)if(expression)statements (2)if( expression ) statements 1 else statements 2 (3)if( expression 1) statements 1 else if (expression 2) statements 2 else if (expression 3) statements 3 else if(expression m) statements m else statements nexexex第第五五章章选选择择结结构构If语语句句的的形形式式Brief Summary if(expression)statementsexpressionstatementsF(0)T(not 0)ex: if(xy) printf(“%d”,x); Firstly,solve the expression. If the value of the expression is not zero,then the corresponding ststement sequence is excuted. If none of the expression is false,then excute the statements after if derectly.第第五五章章选选择择结结构构If语语句句的的形形式式exampleexpressionstatements1statements2TFex: if(xy) printf(“%d”,x); else printf(“%d”,y);if(expression)statements1 else statements2第第五五章章选选择择结结构构If语语句句的的形形式式exampleexpression1expression2expression3expression4statements1statements2statements3statements4 statements5FFFFTTTTex: if (number500) cost=0.15; else if (number300) cost=0.10; else if (number100) cost=0.075; else if (number50) cost=0.05; else cost=0;nested- if statements第第五五章章选选择择结结构构If语语句句的的形形式式example (1)The expression of three forms behind if-statements always is logical or relation expression.DCL of three if- statements forms(2)In form2 and forme3,there is a semicolon in front of else, also in the end of all statements.(3)Behind if or else,it may include only one operate statements,also include many statements ,but should be drawed together with brace.( )第第五五章章选选择择结结构构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(s*(s-a)*(s-b)*(s-c); printf(“area=%6.sf”,area); else printf(“it is not a trilateral”); Notice:The brace( “”)s outer face need not semicolon。Because in the brace() there is a full compound statement .第第五五章章选选择择结结构构If语语句句的的形形式式 original program : main() float a,b,t; scanf(“%f,%f”,&a,&b); if(ab) t=a;a=b;b=t; printf(“%5.2f,%5.2f”,a,b); 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() float a,b,c,t;scanf(“%f ,%f,%f”,&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 :Iput two numbers ,decide them to be equally or not.Result:Enter integer a:12 Enter integer b:12 a=b Result:Enter integer a:12 Enter integer b:9 a!=b 第第五五章章选选择择结结构构If语语句句嵌嵌套套举举例例ReturnGeneral form:expression1?expression2:expression3 Condition operator commands three operate objects,it is a operator alonely in C language.ex: max=(ab) ? a : b;Equal to : if(ab) max= a; else max=b;第第五五章章选选择择结结构构条条件件运运算算符符Condition operator DCL: (1)Execution order : 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 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+1;max= ab ? a : (b+1);ex3:max= ab ? a : c d ? c:d ;max= ab ? a : (c d ? 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); else printf(“%d”,b);printf(“%d”,ab?a:b);(5)The type of expression 1 and expression 2 can be same,also be different.ex: int x; 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()char ch;scanf( “ %c “ , &ch);ch = ( ch = A & ch = Z ) ? ( ch + 32 ) : ch ;printf( “ %c “ , ch ) ;第第五五章章选选择择结结构构条条件件运运算算符符Returnex6:Function -1 (x0)y=Write a programme,input the value of x. Then ouput y.main( ) float x ; int

    注意事项

    本文(表格模板-Chart流程图is 精品.ppt)为本站会员(lao****ou)主动上传,第一文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知第一文库网(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2022 001doc.com网站版权所有   

    经营许可证编号:宁ICP备2022001085号

    本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有,必要时第一文库网拥有上传用户文档的转载和下载权。第一文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知第一文库网,我们立即给予删除!



    收起
    展开