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

Username:   Password: 
 RegisterRegister   
 SOMEONE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
NAS




PostPosted: Thu Nov 28, 2002 11:57 am   Post subject: SOMEONE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

WRITE A PROGRAM TO DIVIDE NAMES IN TWO TO GROUPS THOSE WHO WITH A TO H AND THOSE THAT BEFIN WITH I TO z ASK A PERSON TO ENTER THEIR NAME THEN OUTPUT A MESSAGE INDICATING WHICH GROUP THEY ARE IN.MAKE IT REPEAT FOR EACH NAME.THE USER WILL TYPE end TO QUIT (THE NAMES ARE MIKE,JOHN,CARLA,ANA,TONY)
Sponsor
Sponsor
Sponsor
sponsor
FizixMan




PostPosted: Thu Nov 28, 2002 1:15 pm   Post subject: (No subject)

Well... next time dump the all caps... hurts to read Razz

I'm only going to tell you the possible function you need to complete this. I'm assuming you already have knowledge of "get", "put", "loop", and "exit when".

Quite simply, to look at individual characters within a string, you just need brackets and an index value beside the variable. In this case, we we're looking at the FIRST letter of the name, so we need to look at position 1 and just use a simple "if" statement. if INPUT(1)>="A" and INPUT<="H" then put "Group 1". The reason why we can use less/greater/equal than comparison with strings is becuase Turing can assign numerical equivilents to strings. If you still don't understand how that works, you can alwasy put if INPUT(1)="A" or INPUT(1)="B" INPUT(1)="C" INPUT(1)="D" etc.

That should be enough to let you finish the program. If you need help writing this 11 line program beyond this... well... I guess you could just ask... though seriously, I hope I don't see you asking for more on this otherwise you're probably really behind the rest of the class.
NAS




PostPosted: Thu Nov 28, 2002 3:27 pm   Post subject: hey bro what's the code

hey bro what's the code Shocked Confused
FizixMan




PostPosted: Thu Nov 28, 2002 4:22 pm   Post subject: (No subject)

What's the point in giving you the code? That's essentially cheating... I'm telling you, all you need is the simplicity of looking at the first letter of the string with INPUT(1) that's it!

Do you want me to make a flowchart for you?

code:

         (1)
          |
          |
[get user input]
          |
          |
<does input="QUIT"?>------YES------> [exit program]
          |
         NO
          |
<does input start with "A" or "B" or "C"..... or "H"?>---->[output "GROUP 1"]
          |                                                        |
         NO                                                        |
          |                                                 (go back to 1)
[output "GROUP 2"]
          |
          |
(go back to 1)
Tony




PostPosted: Thu Nov 28, 2002 6:54 pm   Post subject: (No subject)

NAS, if you don't understand programming, do yourself a favour and drop the class...

I mean you wouldn't be able to access the web during your tests and exams... so you're going to fail anyway Confused

Programming is not for everyone... there're lots of other subjects to take.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
FizixMan




PostPosted: Thu Nov 28, 2002 7:10 pm   Post subject: (No subject)

What? No praise for the beautiful ascii flowchart I slaved over for hours! pshhhhhhaaaaaa Mad Mad Mad
haha, j/k... I know it sucks. 8)
Tony




PostPosted: Thu Nov 28, 2002 10:08 pm   Post subject: (No subject)

well actually its a very nice flow chart...

good job on that... if that doesn't make code clear, I don't know what will!
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
NAS




PostPosted: Sun Dec 01, 2002 11:11 am   Post subject: CANT DROP IT

THANKS TO U GUYS I HAVE A 70
NAS




PostPosted: Sun Dec 01, 2002 11:13 am   Post subject: (No subject)

whats the code
Tony




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

You got a 70? Good job! Keep it up.

code:

if name(1) <"H" then
group1 = group1 + name
else
group2 = group1 + name
end if
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  [ 10 Posts ]
Jump to:   


Style:  
Search: