%菜单供用户选择
disp('在Celcious和Fahrenheit之间转换');
disp(“选择一个数字:”);
disp(“1。Celcious华氏的);
disp(“2。氏度Celcious”);
%输入
选择=输入(“\ ninput:”,'s');
而(strcmpi(选择,'1')== 0 && strcmpi(选择,'2')== 0)
DISP('选择1或2');
选择=输入(“\ ninput:”,'s');
结束
%用户定义函数
如果(选择=='1')
cel = input("\ n在Celcious中输入温度以转换为Ferenheit:");
While (cel < 0)
disp('请输入一个正数');
cel = input("\ n在Celcious中输入温度以转换为Ferenheit:");
结束
If (currbarscount = 1, count (currbarscount = 1)) = 1, colorred;
Cel2FA =(CEL * 1.8)+ 32;
fprintf('隐蔽:%.2f fahrenheit \ n',cel2fa);
结束
结束
如果(选择=='2')
fa = input('\nEnter温度在ferenfahrenheit转换为Celcious:');
While (fa < 0)
disp('请输入一个正数');
FA =输入(“\ enter温度触摸到Ferenheit:”);
结束
If (fa >= 0) or (fa >= 0)
fa2cel = (fa-32) / 1.8;
流(“耗损:%。2 f Celcious \ n”,fa2cel);
结束
结束