第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

計(jì)算器的腳本程序老師上傳了嗎?在哪可以下載,或是誰寫好了,分享下唄!

計(jì)算器的腳本程序哪個(gè)美女帥哥分享下呀。。。

正在回答

5 回答

#!/bin/bash


read -p "number1: " num1

read -p "number2: " num2

read -p "ope: " ope


if [ -n "$num1" -a -n "$num2" -a -n "$ope" ]

? ? ? ? then

? ? ? ? ? ? ? ? test1=$(echo $num1 |sed 's/[0-9]//g')

? ? ? ? ? ? ? ? test2=$(echo $num2 |sed 's/[0-9]//g')

? ? ? ? else

? ? ? ? ? ? ? ? echo "enter number is null,try again"

? ? ? ? ? ? ? ? exit 12

fi


if [ -z "$test1" -a -z "$test2" ]

? ? ? ? then

? ? ? ? ? ? ? ? echo "Please enter a valid value"

? ? ? ? ? ? ? ? exit 10

fi



if [ "$ope"=='+' ]

? ? ? ? then

? ? ? ? ? ? ? ? sum=$(( $num1 + $num2 ))

elif [ "$ope"=='-' ]

? ? ? ? then

? ? ? ? ? ? ? ? sum=$(( $num1 - $num2 ))

elif [ "$ope"=='*' ]

? ? ? ? then

? ? ? ? ? ? ? ? sum=$(( $num1 * $num2 ))

elif [ "$ope"=='/' ]

? ? ? ? then

? ? ? ? ? ? ? ? sum=$(( $num1 / $num2 ))

else

? ? ? ? echo "Please enter a valid symbol"

? ? ? ? exit 11

fi


echo "$num1 $ope $num2 = $sum"


0 回復(fù) 有任何疑惑可以回復(fù)我~
#!/bin/bashread?-p?"number1:?"?num1read?-p?"number2:?"?num2read?-p?"ope:?"?opeif?[?-n?"$num1"?-a?-n?"$num2"?-a?-n?"$ope"?]????????then????????????????test1=$(echo?$num1?|sed?'s/[0-9]//g')????????????????test2=$(echo?$num2?|sed?'s/[0-9]//g')????????else????????????????echo?"enter?number?is?null,try?again"????????????????exit?12fiif?[?-z?"$test1"?-a?-z?"$test2"?]????????then????????????????echo?"Please?enter?a?valid?value"????????????????exit?10fiif?[?"$ope"=='+'?]????????then????????????????sum=$((?$num1?+?$num2?))elif?[?"$ope"=='-'?]????????then????????????????sum=$((?$num1?-?$num2?))elif?[?"$ope"=='*'?]????????then????????????????sum=$((?$num1?*?$num2?))elif?[?"$ope"=='/'?]????????then????????????????sum=$((?$num1?/?$num2?))else????????echo?"Please?enter?a?valid?symbol"????????exit?11fiecho?"$num1?$ope?$num2?=?$sum"


0 回復(fù) 有任何疑惑可以回復(fù)我~

#!/bin/bash

read -p "number1: " num1

read -p "number2: " num2

read -p "ope: " ope

if [ -n "$num1" -a -n "$num2" -a -n "$ope" ]

? ? ? ?then

? ? ? ?test1=$(echo $num1 |sed 's/[0-9]//g')

? ? ? ?test2=$(echo $num2 |sed 's/[0-9]//g')

? ? ? ?if [ -z "$test1" -a -z "$test2" ]

? ? ? ? ? ? ? ?then

? ? ? ? ? ? ? ? ? ? ? ?if [ "$ope"=='+' ]

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?then

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sum=$(( $num1 + $num2 ))

? ? ? ? ? ? ? ? ? ? ? ?elif [ "$ope"=='-' ]

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?then

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sum=$(( $num1 - $num2 ))

? ? ? ? ? ? ? ? ? ? ? ?elif [ "$ope"=='*' ]

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?then

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sum=$(( $num1 * $num2 ))

? ? ? ? ? ? ? ? ? ? ? ?elif [ "$ope"=='/' ]

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?then

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sum=$(( $num1 / $num2 ))

? ? ? ? ? ? ? ? ? ? ? ?else

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?echo "Please enter a valid symbol"

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?exit 10

? ? ? ? ? ? ? ? ? ? ? ?fi

? ? ? ? ? ? ? ?else

? ? ? ? ? ? ? ? ? ? ? ?echo "Please enter a valid value"

? ? ? ? ? ? ? ? ? ? ? ?exit 11

? ? ? ?fi

else

? ? ? ?echo "enter number is null,try again"

? ? ? ?exit 12

fi

echo "$num1 $ope $num2 = $sum"


0 回復(fù) 有任何疑惑可以回復(fù)我~

哇唔,謝謝可愛的銀兒

0 回復(fù) 有任何疑惑可以回復(fù)我~
#!/bin/bash
read?-p?"please?input?a?num1:"?num1??????????#用鍵盤輸入數(shù)字
read?-p?"please?input?a?num2:"?num2
read?-p?"please?input?a?operator:"?ope

#判斷是否為空
if?[?-z?"$num1"?-a?-z?"$num2"?-a?-z?"$ope"?]?#-z為空取真,中括號(hào)里兩邊需要空格
????????then
????????echo?"is?null"
????????exit?10
fi

#判斷是否為數(shù)值,將num1中數(shù)字替換為空,來進(jìn)行判斷
test1=$(echo?$num1|sed?'s/[0-9]//g')
test2=$(echo?$num2|sed?'s/[0-9]//g')
if?[?-n?"$test1"?-a?-n?"$test2"?]??#-n?非空取真
????????then
????????echo?"請(qǐng)輸入數(shù)值"
????????exit?11
fi

if?[?'$ope'=='+'?-o?'$ope'=='-'?-o?'$ope'=='*'?-o?'$ope'=='/'?]
????????then
????????????????sum=$(($num1$ope$num2))?#運(yùn)算要加雙括號(hào)

????????????????echo?"$num1$ope$num2=$sum"
else
????????exit?12
fi

自己寫的,邏輯清晰一些 沒有嵌套

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

0_菇?jīng)鰧⑽易魃鮛0

這里邏輯關(guān)系應(yīng)該用或才對(duì)呢 if [ -z "$num1" -o -z "$num2" -o -z "$ope" ] #-z為空取真,中括號(hào)里兩邊需要空格 if [ -n "$test1" -o -n "$test2" ] #-n 非空取真
2019-09-05 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

計(jì)算器的腳本程序老師上傳了嗎?在哪可以下載,或是誰寫好了,分享下唄!

我要回答 關(guān)注問題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)