MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] 小程序有点问题,求高手! (https://www.labfans.com/bbs/showthread.php?t=13501)

独家忆 2011-05-26 23:32

小程序有点问题,求高手!
 
year=input(' year:=');
animals='猴鸡狗猪鼠牛虎兔龙蛇马羊';
k=mod(year,12)+1;
s=animals(k);
answer=strcat(int2str(year),'年是',s,'年');
总是运行不了。。:(

laosam280 2011-05-30 20:31

回复: 小程序有点问题,求高手!
 
这样就可以了:

year=input(' year:=');
animals=['猴' '鸡' '狗' '猪' '鼠' '牛' '虎' '兔' '龙' '蛇' '马' '羊'];
k=mod(year,12)+1;
s=animals(k);
answer=strcat(int2str(year),'年是',s,'年')

laosam280 2011-05-30 20:32

回复: 小程序有点问题,求高手!
 
这样就可以了:

year=input(' year:=');
animals=['猴' '鸡' '狗' '猪' '鼠' '牛' '虎' '兔' '龙' '蛇' '马' '羊'];
k=mod(year,12)+1;
s=animals(k);
answer=strcat(int2str(year),'年是',s,'年')


所有时间均为北京时间。现在的时间是 13:01

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.