val = str2double(input('enter number','s'));
chr = input('enter letter','s');
switch chr
case 's'
disp(sin(val))
case 'c'
disp(cos(val));
case 't'
disp(tan(val));
otherwise
disp('Oh no! Try a different character.');
end
I wrote this code to find the sin,cos,or tan of an entered individual number. I now need to modify it so that instead of reading a single character/number, the program continually reads character/number pairs and displays the trigonometry result. If a number outside the range [-100, 100] is entered, the program should not display the trigonometry result and should ask for another character/number pair to be entered. I can't figure out how to make the initial modifications of reading in pairs - any shortcuts I can use?