网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

shell简单计算器

#!/bin/bash

function tool_menu()
{
    echo "****************************************************"
    echo "*                                                  *"
    echo "*              calculation  tools                  *"
    echo "*                                                  *"
    echo "****************************************************"
}
function menu_choice()
{
    echo "A: Add two num."
    echo "B: Minus two num."
    echo "C: Multiply two num."
    echo "D:Divide two num."
    echo "Q: Close this function."
    echo "Please input your chiose:"
}
function add_num()
{
    echo "please inut your first num:"
    read first_num
    echo "please inut your second num:"
    read second_num
    let add=$first_num+$second_num
    echo "$first_num+$second_num=$add"
    return 0
}
function minus_num()
{
    echo "please inut your first num:"
    read first_num
    echo "please inut your second num:"
    read second_num
    let minus=$first_num-$second_num
    echo "$first_num-$second_num=$minus"
    return 0
}
function multiply_num()
{
    echo "please inut your first num:"
    read first_num
    echo "please inut your second num:"
    read second_num
    let multiply=$first_num*$second_num
    echo "$first_num*$second_num=$multiply"
    return 0
}

function divide_num()
{
    echo "please inut your first num:"
    read first_num
    echo "please inut your second num:"
    read second_num
    let divide=$first_num/$second_num
    echo "$first_num/$second_num=$divide"
    return 0
}
function main()
{
    clear
    tool_menu
    while :
    do
        menu_choice
        read menu_choice
        case $menu_choice in
            A|a) add_num ;;
            B|b) minus_num ;;
            C|c) multiply_num ;;
            D|d) divide_num ;;
            Q|q) break;;
            *) echo "Input error,please try agin.";;
        esac
    done
}
main
exit 0

站在用户的角度思考问题,与客户深入沟通,找到铁西网站设计与铁西网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:做网站、网站设计、企业官网、英文网站、手机端网站、网站推广、申请域名网站空间、企业邮箱。业务覆盖铁西地区。

 模板
#!/bin/bash

function tool_menu()
{
    echo "****************************************************"
    echo "*                                                  *"
    echo "*              calculation  tools                  *"
    echo "*                                                  *"
    echo "****************************************************"
}
function menu_choice()
{
    echo "A: Add two num."
    echo "B: Minus two num."
    echo "C: Multiply two num."
    echo "D:Divide two num."
    echo "Q: Close this function."
    echo "Please input your chiose:"
}
function add_num()
{

    echo "add."
}
function minus_num()
{

    echo "minus."
}
function multiply_num()
{
    echo "multiply."

}

function divide_num()
{

    echo "divide."

}
function main()
{
    clear 模板

    tool_menu
    while :
    do
        menu_choice
        read menu_choice
        case $menu_choice in
            A|a) add_num ;;
            B|b) minus_num ;;
            C|c) multiply_num ;;
            D|d) divide_num ;;
            Q|q) break;;
            *) echo "Input error,please try agin.";;
        esac
    done
}
main
exit 0


名称栏目:shell简单计算器
转载注明:http://bjjierui.cn/article/ijpghs.html

其他资讯