LAB 31: THE switch STATEMENT

 <  Day Day Up  >  

LAB 31: THE switch STATEMENT

  1. Rewrite the following script using a switch statement:

     #!/bin/csh f # Grades program echo n "What was your grade on the test? " set score = $< if ($grade >= 90 && $grade <= 100) then      echo You got an A\! else if ($grade >= 80 && $grade <= 89) then      echo You got a B. else if ($grade >= 70 && $grade <= 79) then      echo "You're average." else if ($grade >= 60 && $grade <= 69) then      echo Better study harder else      echo Better luck next time. endif 

  2. Rewrite the lookup script using switch statements for each of the menu items.

 <  Day Day Up  >  


UNIX Shells by Example
UNIX Shells by Example (4th Edition)
ISBN: 013147572X
EAN: 2147483647
Year: 2004
Pages: 454
Authors: Ellie Quigley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net