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

Username:   Password: 
 RegisterRegister   
 Get first name of person- Weird error
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh pageAdd this topic to your bookmarks (CTRL-D) View next topic
Author Message
simon66




PostPosted: Fri Jan 09, 2009 2:39 pm   Post subject: Get first name of person- Weird error

Hey im writing a program that a user inputs a list of first names and when they type stop, the names will output in alphabetical order. This is my code

code:
%This program will output last name fist
var firstname:string
var reply:string:=""
loop
put "What is your first name? Type stop to close program!"
get firstname
exit when firstname="stop"
if firstname (1) > reply then
firstname := reply
end if
end loop
put "The alphabetically last name is ", firstname


What is wrong here?
 
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Fri Jan 09, 2009 2:43 pm   Post subject: RE:Get first name of person- Weird error

firstname has to be an array of string, and you need a sorting algorithm. Look up bubble sort on wiki.
 
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh pageAdd this topic to your bookmarks (CTRL-D) View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: