教えてくれるmatlab内の関数をコンパイルしています
- 三角形の 3 番目の辺
- 三角形の周囲の長さ
- 三角形の面積
私はこれまでにこれを思いついた
function findHypotenuse(a, b)
c=sqrt(a^2+b^2);
circumference = (a+b+c);
area = (.5*(a*b));
fprintf('Triangle has side c which is %g.\n',c)
fprintf('Triangle has a circumference of %g.\n',circumference)
fprintf('Triangle has area of %g.\n',area)
fprintf('Triangle has area of %g.\n',area)
その結果、コマンドウィンドウに入れると、このようなものが得られます
>> findHypotenuse(6,8)
Triangle has side c which is 10.
Triangle has a circumference of 24.
Triangle has area of 24.
Triangle has area of 24.
「a Triangle with side _ and side _ has side c which c」の行に沿って何かを言う方法と、見つかった他の2つのものと同じ形式を理解するのに助けが必要です。
また*三角形が二等辺三角形である場合にイエスかノーかを教えてくれる関数をコンパイルしたい