pb_add.m
来自「matlab从入门到精通第13章书后源码对初学者很有帮助」· M 代码 · 共 24 行
M
24 行
function pb_add(pb_htable)
% 向电话本中添加记录,姓名和电话号码
disp 'Type the name for the new entry, followed by Enter.'
disp 'Then, type the phone number(s), one per line.'
disp 'To complete the entry, type an extra Enter.'
name = input(':: ','s');
entry=[name '^'];
while 1
line = input(':: ','s');
if isempty(line)
break;
else
entry=[entry line '^'];
end;
end;
if strcmp(entry, '^')
disp 'No name entered'
return;
end;
pb_htable.put(pb_keyfilter(name),entry);
disp ' '
disp(sprintf('%s has been added to the phone book.', name));
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?