Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Exit command/Coding for turing?
Index -> Programming, Turing -> Turing Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
spever23




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Raknarg




PostPosted: Fri Jan 10, 2014 9:58 am   Post subject: RE:Exit command/Coding for turing?

why do you have another loop?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: