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

Username:   Password: 
 RegisterRegister   
 Need help for a couple of progs
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Doctor_Lyons




PostPosted: Mon Oct 31, 2005 10:54 am   Post subject: Need help for a couple of progs

I am trying to make a couple of programs and im having trouble

My first program is as such:

Create a program that will allow the user to input a string of any size. It should then allow the user to choose to do one of the following:

Output the entire string in lower case letters
Output the entire string in capitals
Output the entire string with only the 1st letter of each word capitalized

My Second Program is as such:

Create a program that will illustrate a planet revolving around the sun in a perfectly circular orbit. The planet will also have a moon revolving around ther itself in the opposite direction.

and Finally the 3rd program is as such:

Create a program which will have the user input string of three or more words. The program should then calculate and output the length of the longest and shortest word in the string. Also the longest and shortest words must be outputted as well.

Please have a look at any of these programs and if you can help me out that would be great.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Oct 31, 2005 10:57 am   Post subject: (No subject)

what are you having trouble with?
Doctor_Lyons




PostPosted: Mon Oct 31, 2005 11:05 am   Post subject: (No subject)

For the first prog I am trying to make a sentence come out either as all caps, all lowercase or first letter with caps. There has to be a trap that prevents the user from mixing caps and lower case when converting lower to upper and vice versa.

thisd is what i have for my first prog

var word, space, choice, character : string
var letter, counter : int
counter := 0
space := " "
put "please enter a word or series of words"
get word : *
put "Enter if you would like the sentence to be: all upper case (A), all lower case (B), first letter of each word capitalized (C)"
get choice
if choice = "A" or choice = "a" then
for i : 1 .. length (word)
put chr (ord (word (i)) - 32), space ..
end for
end if
if choice = "B" or choice = "b" then
for i : 1 .. length (word)
put chr (ord (word (i)) + 32),space ..

end for
end if
if choice="C" or choice="c" then
put chr (ord (word(1)) - 32),word(2..length(word)) ..

end if


for my second i need the earth to orbit the sun and a moon to orbit the earth. Both must do this continously.

here is what i have so far

import GUI in "%oot/lib/GUI"
View.Set ("graphics:1280;1024,nobuttonbar")
GUI.SetBackgroundColor (black)
var pic : int := Pic.FileNew ("sun.jpg")
var pic2 : int := Pic.FileNew ("betterearth.jpg")
Pic.Draw (pic, 500, 500, picMerge)
Pic.Draw (pic2, 350, 300, picMerge)
loop
for i : 1 .. 360
var picearth : int := Pic.Rotate (pic2, i, 240, 270)
Pic.Draw (picearth, 350, 300, picMerge)
end for
end loop

and lastly i need a program that will have the user input string of three or more words. The program should then calculate and output the length of the longest and shortest word in the string. Also the longest and shortest words must be outputted as well. I couldnt figure out where to start with this one so I have no sample code. All help is appriciated.
beard0




PostPosted: Mon Oct 31, 2005 11:15 am   Post subject: (No subject)

For your first porgram:
Look into Str.Upper and Str.Lower in the turing reference manual.

For your second program:
Why on earth are you importing GUI? You can set the background colour with colourback(colr : int)
Also - use trig functions for this, to determine the position in which the earth should find itself, then more trig to find out where the moon should be relative to earth.

For your third program:
What do you mean you couldn't even start it? Do you know how to get input? Great! Then start it. Also check out the tutorials section for a post on string manipulation (good for your first program too).
Doctor_Lyons




PostPosted: Tue Nov 01, 2005 9:58 am   Post subject: U suck

This website is beyond useless, I am going to fail my comp sci course because of u idiots.
Thanks for nothing!
beard0




PostPosted: Tue Nov 01, 2005 10:01 am   Post subject: (No subject)

No, this website is hugely helpful. If we were to feed you all the answers, then yes, you would fail. If we help you along, and you help yourself you will learn, and be able to pass the course.

And as a final note:
Doctor_Lyons wrote:
I am going to fail my comp sci course because of u idiots.

We have no obligation to help you in the first place.
Doctor_Lyons




PostPosted: Tue Nov 01, 2005 10:14 am   Post subject: u Loser

I think u are a flaming homosexual who has no life and is gay gay gay i am goin to fail now becasue of ur flaming homiosexual ways
thanks agian and have a blockbuster night
Tony




PostPosted: Tue Nov 01, 2005 10:22 am   Post subject: (No subject)

hey beard0 - thx for trying to put up with that character.

But hey -- 2 bans already, and its only 10:20 in the morning, what a great day Laughing

I'd have to say.. Doctor_Lyons is beyond useless, he's going to fail because he doesn't want to do work assigned.
Sponsor
Sponsor
Sponsor
sponsor
Doctor_Moreau




PostPosted: Tue Nov 01, 2005 10:23 am   Post subject: (No subject)

YOU AKLL GAY YOU CANT STOP ME FAGS

UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY UR ALL GAY
codemage




PostPosted: Tue Nov 01, 2005 1:03 pm   Post subject: (No subject)

Based on the obsessive rantings just displayed here, I wouldn't be surprised if the good doctor putts from the rough himself.

Oh - and watch out for the newest incarnation, Doctor_Iacovitti. Wink
Tony




PostPosted: Tue Nov 01, 2005 2:42 pm   Post subject: (No subject)

The thing is -- he has to sign up for a new email address each time Laughing
beard0




PostPosted: Tue Nov 01, 2005 4:13 pm   Post subject: (No subject)

Tony wrote:
The thing is -- he has to sign up for a new email address each time :lol:


Actually no. For obvious reasons, I wont say how here, but PM me if you're interested.
haseeb




PostPosted: Tue Nov 01, 2005 4:31 pm   Post subject: (No subject)

That kid is such a fag.
[Gandalf]




PostPosted: Tue Nov 01, 2005 4:46 pm   Post subject: (No subject)

Wow... Just wow. Hope he does fail.

Is it me, or should ip bans be given out a little more freely. I am sure most couldn't get around them.

"who has no life"
hehe, and who is the one spending their time registering new accounts?
codemage




PostPosted: Wed Nov 02, 2005 8:39 am   Post subject: (No subject)

You have to be careful with banning IPs. Some schools are set up so that the whole internal net connects to the internet through a few IPs. Banning a users' IP could block out a whole school.

An IP trace would probably figure that out pretty quickly though.
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 2  [ 16 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: