How the hell did i do this! funny as hell

Reply

Join Date: Jul 2008
Posts: 38
Reputation: plike922 is an unknown quantity at this point 
Solved Threads: 0
plike922's Avatar
plike922 plike922 is offline Offline
Light Poster

How the hell did i do this! funny as hell

 
0
  #1
Sep 15th, 2008
run it type hello, press enter then type end in a c ompiler
  1. #include <stdio.h>
  2. #include "strlib.h"
  3. #include "simpio.h"
  4. #include "genlib.h"
  5. #include "string.h"
  6.  
  7. #define size 50
  8.  
  9. void reverse(char rev[]);
  10.  
  11. int main()
  12. {
  13. char rev[size], i;
  14.  
  15. printf("Please enter a sentence and end the sentence with a enter than end \n");
  16. reverse(rev);
  17. system("pause");
  18. }
  19.  
  20. void reverse(char rev[])
  21. {
  22. string ch;
  23. int i;
  24.  
  25. if(StringCompare((ch = GetLine()), "end") != 0)
  26. {
  27. for(i=1; i<StringLength(ch); i++)
  28. {
  29. rev[i] = IthChar(ch, i);
  30. }
  31. reverse(rev);
  32. }
  33. else;
  34.  
  35. for(i=48; i<size; i--)
  36. {
  37. if(rev[i] == 'end');
  38. else
  39. {
  40. printf("%c",rev[i]);
  41. }
  42. }
  43. }
Last edited by Ancient Dragon; Sep 15th, 2008 at 11:22 pm. Reason: add line numbers for convenience.
_________________________
||||||||||[][][]|||||||||||||||||||
|||||||||||||||____|
||||||||||
||||||||||
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,334
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1454
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: How the hell did i do this! funny as hell

 
0
  #2
Sep 15th, 2008
I don't know how you did it, but I do know the code you posted can't compile cleanly. For example the loop that starts on line 35 is all wrong. It could be written like this (or use whatever string comparison function you wish).
  1. for(i=48; i<size; i--)
  2. {
  3. if( strcmp(&rev[i], "end") != 0)
  4. {
  5. printf("%c",rev[i]);
  6. }
  7. }
Last edited by Ancient Dragon; Sep 15th, 2008 at 11:25 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2,029
Reputation: Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of 
Solved Threads: 176
Aia's Avatar
Aia Aia is offline Offline
Postaholic

Re: How the hell did i do this! funny as hell

 
0
  #3
Sep 15th, 2008
>How the hell did i do this! funny as hell
That's nothing! I'll tell you what would be funny as hell. A new commercial with Bill Gates and Jerry Seinfeld, playing on violin "Fiddler On The Roof", as they hand stand, naked, against the wall. Makes you wonder what they used to play the violin with, doesn't it?
Last edited by Aia; Sep 15th, 2008 at 11:38 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,334
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1454
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: How the hell did i do this! funny as hell

 
0
  #4
Sep 16th, 2008
Originally Posted by Aia View Post
>How the hell did i do this! funny as hell
That's nothing! I'll tell you what would be funny as hell. A new commercial with Bill Gates and Jerry Seinfeld, playing on violin "Fiddler On The Roof", as they hand stand, naked, against the wall. Makes you wonder what they used to play the violin with, doesn't it?

Oh! that would be discusting, not funny. I posted a link to one of their commercial over in Geek's Lounge yesterday. They are anything but funny.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2,029
Reputation: Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of 
Solved Threads: 176
Aia's Avatar
Aia Aia is offline Offline
Postaholic

Re: How the hell did i do this! funny as hell

 
0
  #5
Sep 16th, 2008
Originally Posted by Ancient Dragon View Post
Oh! that would be discusting, not funny.
C'mon, did you miss it? Don't you remember that in that musical there's a song titled: "If I were a rich man"
Oh well, “De gustibus et coloribus non disputandum est”
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC