Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How to run this code?
조회 수: 3 (최근 30일)
이전 댓글 표시
A=input('What would you like to do?: ','s');
if strcmp(A,'add book')
Tit= input('Ask for title: ','s');
Aut=input('Ask for author: ','s');
No_pg=input('Ask for number of pages: ','s');
fprintf('Title: %s \n',Tit)
fprintf('Author: %s \n',Aut)
fprintf('Number of pages: %s \n',No_pg)
elseif strcmp(A,'quit')
disp('Good bye')
else
disp('Nothing entered')
end
댓글 수: 2
Jan
2017년 4월 25일
The question is not clear. Most likely you can either run this in the command window or write it to a script or function M-file to start it from there. Please explain which problem you have with running this code.
답변 (1개)
KSSV
2017년 4월 25일
A=input('What would you like to do?: ','s');
if strcmp(A,'add book')
Tit= input('Ask for title: ','s');
Aut=input('Ask for author: ','s');
No_pg=input('Ask for number of pages: ','s');
fprintf('Title: %s \n',Tit)
fprintf('Author: %s \n',Aut)
fprintf('Number of pages: %s \n',No_pg)
elseif strcmp(A,'hi')
disp('Good bye')
else
disp('Nothing entered')
end
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!