FishProfiles.com Message Forums |
faq | etiquette | register | my account | search | mailbox |
The Daily GEEK Challenge!!! | |
eogle Hobbyist Posts: 58 Kudos: 24 Votes: 56 Registered: 28-Feb-2006 | do I have to include the commas? ... I guess I will -Eric "He is no fool who gives what he cannot keep to gain what he cannot lose." |
Posted 13-Apr-2006 07:12 | |
eogle Hobbyist Posts: 58 Kudos: 24 Votes: 56 Registered: 28-Feb-2006 | wow, I just realized its a lot harder to do it with the commas in there. Im gonna do it without and see what you say. If it doesnt count, Ill edit it. Edit: We haven't leanred formatted print statements yet (I'm a freshman) -Eric "He is no fool who gives what he cannot keep to gain what he cannot lose." |
Posted 13-Apr-2006 07:25 | |
eogle Hobbyist Posts: 58 Kudos: 24 Votes: 56 Registered: 28-Feb-2006 | i got it, and if I let it run, it would take FOREVER here's the code: #include <stdio.h> #include <math.h> int main(void) { int I; I = 2000000000; printf("%d bottles of beer on the wall\n", I); printf("%d bottles of beer\n", I); printf("Take one down pass it around\n" for (I = 1999999999; I > 0; I -= 1) { printf("%d bottles of beer on the wall\n", I); printf("%d bottles of beer on the wall\n", I); printf("%d bottles of beer\n", I); printf("Take one down pass it around\n" } printf ("No bottles of beer on the wall\n" return 0; } -Eric "He is no fool who gives what he cannot keep to gain what he cannot lose." |
Posted 13-Apr-2006 08:10 | |
Posted 13-Apr-2006 14:28 | This post has been deleted |
NewBreeder16 Hobbyist Posts: 149 Kudos: 94 Votes: 16 Registered: 11-Feb-2005 | you have too much time on your hands, eric. -NewBreeder16 _______________________________________________ You can call me Newb too, since I'm not nere new any more. |
Posted 13-Apr-2006 14:28 | |
eogle Hobbyist Posts: 58 Kudos: 24 Votes: 56 Registered: 28-Feb-2006 | It only took me like 30 minutes.... It was fun.... sort of.... -Eric "He is no fool who gives what he cannot keep to gain what he cannot lose." |
Posted 13-Apr-2006 17:17 | |
eogle Hobbyist Posts: 58 Kudos: 24 Votes: 56 Registered: 28-Feb-2006 | It prints about 2,000 verses per second. At this rate, it will print the entire song in about 11.57 days! -Eric "He is no fool who gives what he cannot keep to gain what he cannot lose." |
Posted 13-Apr-2006 18:41 | |
poisonwaffle Mega Fish Posts: 1397 Kudos: 591 Registered: 11-Feb-2003 | Wow, Eric, you either have a really slow computer, or C is really slow It only took about 6 hours for my school computer to run the program when I wrote it in Java I'm giving this one to Eric tho... Excel isn't really a programming language, lion Next challenge will be up in ~10 hours |
Posted 13-Apr-2006 18:50 | |
eogle Hobbyist Posts: 58 Kudos: 24 Votes: 56 Registered: 28-Feb-2006 | Well, it was on Purdue's computer that I ran it, and they are really slow. I have a feeling that if I ran it on my laptop, it would be faster. -Eric "He is no fool who gives what he cannot keep to gain what he cannot lose." |
Posted 13-Apr-2006 20:17 | |
Posted 13-Apr-2006 20:58 | This post has been deleted |
superlion Mega Fish Posts: 1246 Kudos: 673 Votes: 339 Registered: 27-Sep-2003 | |
Posted 13-Apr-2006 21:41 | |
eogle Hobbyist Posts: 58 Kudos: 24 Votes: 56 Registered: 28-Feb-2006 | well, its been 10 hours.... -Eric "He is no fool who gives what he cannot keep to gain what he cannot lose." |
Posted 14-Apr-2006 16:35 | |
moondog Moderator The Hobnob-lin Posts: 2676 Kudos: 1038 Votes: 4366 Registered: 30-Sep-2002 | not sure why you include math.h?? you're not using any math functions there... and it seems like this would be a little more efficient: #include <stdio.h> int main(void) { int I; I = 2000000000; while (I > 0) { printf("%d bottles of beer on the wall\n", I); printf("%d bottles of beer\n", I); printf("Take one down pass it around\n"; I -= 1; printf("%d bottles of beer on the wall\n", I); } printf ("No bottles of beer on the wall\n"; return 0; } "That's the trouble with political jokes in this country... they get elected!" -- Dave Lippman |
Posted 14-Apr-2006 16:42 | |
eogle Hobbyist Posts: 58 Kudos: 24 Votes: 56 Registered: 28-Feb-2006 | Yea, it's just a habbit to include math.h. You know, in yours, when I = 1, you will do: printf("%d bottles of beer on the wall\n", I); printf("%d bottles of beer\n", I); printf("Take one down pass it around\n"; I -= 1; printf("%d bottles of beer on the wall\n", I); } printf ("No bottles of beer on the wall\n"; which will print: 1 bottles of beer on the wall 1 bottles of beer Take one down pass it around 0 bottles of beer on the wall No bottles of beer on the wall This declares that there exists no bottles of beer on the wall twice and it does not match up to the last verse of the song. An if statement to break the loop would be helpful there. Also, yours made me realize that when there is 1 bottles of beer left, the word bottles should be singular, not plural. We both messed that up. Anyway, its no big deal. -Eric "He is no fool who gives what he cannot keep to gain what he cannot lose." |
Posted 14-Apr-2006 17:33 | |
poisonwaffle Mega Fish Posts: 1397 Kudos: 591 Registered: 11-Feb-2003 | Sorry, I've missed the last 2 days I'm 2 hours late on this one, I'm dead tired, and I can't think up another one... I'll try to have one up sometime tomarrow afternoon, but I dunno... I was out biking 'till 11:30pm tonight, gimme a break |
Posted 15-Apr-2006 07:16 | |
moondog Moderator The Hobnob-lin Posts: 2676 Kudos: 1038 Votes: 4366 Registered: 30-Sep-2002 | eogle, that's what testing is for "That's the trouble with political jokes in this country... they get elected!" -- Dave Lippman |
Posted 15-Apr-2006 22:04 | |
Posted 17-Apr-2006 03:14 | This post has been deleted |
eogle Hobbyist Posts: 58 Kudos: 24 Votes: 56 Registered: 28-Feb-2006 | So are we not doing this thing anymore or what? -Eric "He is no fool who gives what he cannot keep to gain what he cannot lose." |
Posted 18-Apr-2006 00:29 | |
eogle Hobbyist Posts: 58 Kudos: 24 Votes: 56 Registered: 28-Feb-2006 | When is this thing gonna happen again? -Eric "He is no fool who gives what he cannot keep to gain what he cannot lose." |
Posted 20-Apr-2006 16:06 | |
superlion Mega Fish Posts: 1246 Kudos: 673 Votes: 339 Registered: 27-Sep-2003 | |
Posted 20-Apr-2006 17:16 | |
poisonwaffle Mega Fish Posts: 1397 Kudos: 591 Registered: 11-Feb-2003 | The only other challenges I can think of would be random simple programming challenges And I don't know C yet (doubt I ever will...not a big fan of programming)...all I know is Java How 'bout this for a challenge: fix my laptop (j/k) I'll just turn it over to you guys... if you can come up with a challenge, post it up |
Posted 21-Apr-2006 04:08 | |
eogle Hobbyist Posts: 58 Kudos: 24 Votes: 56 Registered: 28-Feb-2006 | That's cool, if I think of any I will post them. -Eric "He is no fool who gives what he cannot keep to gain what he cannot lose." |
Posted 21-Apr-2006 05:41 | |
Pages: 1, 2, 3 |
Jump to: |
The views expressed on this page are the implied opinions of their respective authors.
Under no circumstances do the comments on this page represent the opinions of the staff of FishProfiles.com.
FishProfiles.com Forums, version 11.0
Mazeguy Smilies