欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    matlab选择结构程序设计答案讲解学习.docx

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

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

    matlab选择结构程序设计答案讲解学习.docx

    1、matlab选择结构程序设计答案讲解学习matlab选择结构程序设计答案实验三 选择结构程序设计一、 实验目的1、 掌握建立和执行M文件的方法。2、 掌握利用if语句实现选择结构的方法。3、 掌握利用switch语句实现多分支选择结构的方法。4、 掌握try语句的使用。二、 实验内容1、 求分段函数的值。用if语句实现,分别输出x=-5.0,3.0,1.0,2.0,2.5,3.0,5.0时的y值。x=input(please input the value of x);if x=0&x aaaaaplease input the value of x-3.0y = 11 aaaaaplease

    2、 input the value of x1.0y = 2 aaaaaplease input the value of x2.0y = 1 aaaaaplease input the value of x2.5y = -0.2500 aaaaaplease input the value of x3.0y = 5 aaaaaplease input the value of x5.0y = 192、 输入一个百分制成绩,要求输出成绩等级A、B、C、D、E。其中90分100分为A,80分89分为B,70分79分为C,6069分为D,60分以下为E。要求:(1) 分别用if语句和switch语句

    3、实现。(2) 输入百分制成绩后要判断该成绩的合理性,对不合理性的成绩应输出出错信息。If语句s=input(please input the score:);if s=90&s=80&s=70&s=60&s0&s bbbplease input the score:94rank =A bbbplease input the score:75rank =C bbbplease input the score:-3rank =wrong socre bbbplease input the score:456rank =wrong socreSwitch语句score=input(please in

    4、put the score:);switch floor(score/10) case9,10 rank=A; case8 rank=B; case7 rank=C; case6 rank=D; case num2cell(0:5) rank=E; otherwise rank=wrong score;endrank=rank cccplease input the score:-3rank =wrong score cccplease input the score:456rank =wrong score cccplease input the score:94rank =A cccple

    5、ase input the score:45rank =E3、 硅谷公司员工的工资计算方法如下:(1)、工作时数超过120小时者,超过部分加发15%。(2)、工作时数低于60小时者,扣发700元。(3)、其余按每小时84元计发。试编程按输入的工号和该号员工的工时数,计算应发工资。number=input(please input work number:);h=input(please input work hours:);if h120 wage=120*84+(h-120)*84*1.15;elseif h dddplease input work number:01please inpu

    6、t work hours:74wage = 6216 dddplease input work number:02please input work hours:53wage = 3752 dddplease input work number:03please input work hours:135wage = 115294、 设计程序,完成两位数的加、减、乘、除四则运算,即产生两个两位随机整数,再输入一个运算符号,做相应的运算,并显示相应的结果。x=input(please input a sign:,s);x1=round(rand(1)*90+10);x2=round(rand(1)

    7、*90+10);if x=+ answer=x1+x2;elseif x=- answer=x1-x2;elseif x=* answer=x1*x2;elseif x=/ answer=x1/x2;endx1x2answer eeeplease input a sign:+x1 = 83x2 = 11answer = 94 eeeplease input a sign:-x1 = 23x2 = 28answer = -55、 建立56矩阵,要求输出矩阵第n行元素。当n值超过矩阵的行数时,自动转为输出矩阵的最后一行元素,并给出出错信息。x=rand(5,6);n=input(please input n:);if n0&n5; y=x(5,:); disp(wrong n);elseif n eeeplease input n:4y = 0.9383 0.2789 0.4787 0.9222 0.9238 0.5945 eeeplease input n:7wrong ny = 0.4397 0.1121 0.9442 0.5744 0.1443 0.3099 eeeplease input n:-3y =wrong n


    注意事项

    本文(matlab选择结构程序设计答案讲解学习.docx)为本站会员主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(点击联系客服),我们立即给予删除!

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




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

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开