Computer Science Canada

Exit command/Coding for turing?

Author:  spever23 [ Fri Jan 10, 2014 9:46 am ]
Post subject:  Exit command/Coding for turing?

How to I exit

var name : string %A string is text

put "What is your name?"
get name
put ""
put "Hello, ", name, "!"

loop
put "Thank you for using Testing,", name
var tribase, triheight : int
var hypoteneuse, perimeter_tri, areatri : real
put "Please enter the base of the right triangle"
get tribase
put "Please enter the height of the right triangle"
get triheight
hypoteneuse := sqrt(tribase * tribase + triheight * triheight)
perimeter_tri := tribase + triheight + hypoteneuse
areatri := (tribase * triheight)/2
put "The hypoteneuse of the triangle is ", hypoteneuse
put "The perimeter of the triangle is ", perimeter_tri
put "The area of the triangle is ", areatri
var answer : string

loop
put " Would you like to quit? Type 'quit' to quit "
get answer

if answer = "quit" then
exit
else
put "Ok"
end if
end loop

end loop

Author:  Raknarg [ Fri Jan 10, 2014 9:58 am ]
Post subject:  RE:Exit command/Coding for turing?

why do you have another loop?


: