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

Username:   Password: 
 RegisterRegister   
 hey guys sorry to bug every1 but i need help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
baby girl




PostPosted: Sun Dec 01, 2002 11:44 am   Post subject: hey guys sorry to bug every1 but i need help

Write a program to read a series of first names of ppl .after reading the series (you will need a signal), output the name that is alphabetically last ???whats the code for that and the flowchart too??


that program i dont get can any1 help me out
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun Dec 01, 2002 2:12 pm   Post subject: (No subject)

well you'll get an input of amount of names to be entered
code:
get namesNum

then run a code inputing names into array
code:
for i:1..namesNum
get name(i)
end for


then use bubble sort to find "biggest" name alphabetically

code:
for i:1..namesNum -1
if name(i) > name(i+1)
then
name(i+1) = name(i)
end if
end for


At the end, name(namesNum) will be alphabetically last in the list. Though this code with screw up the array. If you need names for further use, you store the name in another variable
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: