DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C (http://www.daniweb.com/forums/forum118.html)
-   -   How the hell did i do this! funny as hell (http://www.daniweb.com/forums/thread145997.html)

plike922 Sep 15th, 2008 10:04 pm
How the hell did i do this! funny as hell
 
run it type hello, press enter then type end in a c ompiler
#include <stdio.h>
#include "strlib.h"
#include "simpio.h"
#include "genlib.h"
#include "string.h"

#define size 50

void reverse(char rev[]);

int main()
{
        char rev[size], i;

        printf("Please enter a sentence and end the sentence with a enter than end \n");
        reverse(rev);
        system("pause");
}

void reverse(char rev[])
{
        string ch;
        int i;

        if(StringCompare((ch = GetLine()), "end") != 0)
        {
                for(i=1; i<StringLength(ch); i++)
                {
                rev[i] = IthChar(ch, i);
                }
                reverse(rev);
        }
        else;

        for(i=48; i<size; i--)
        {
                if(rev[i] == 'end');
                else
                {
                printf("%c",rev[i]);
                }
        }
}

Ancient Dragon Sep 15th, 2008 10:23 pm
Re: How the hell did i do this! funny as hell
 
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).
for(i=48; i<size; i--)
        {
                if( strcmp(&rev[i], "end") != 0)
                {
                printf("%c",rev[i]);
                }
        }

Aia Sep 15th, 2008 10:32 pm
Re: How the hell did i do this! funny as hell
 
>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?

Ancient Dragon Sep 15th, 2008 11:02 pm
Re: How the hell did i do this! funny as hell
 
Quote:

Originally Posted by Aia (Post 691954)
>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.

Aia Sep 15th, 2008 11:16 pm
Re: How the hell did i do this! funny as hell
 
Quote:

Originally Posted by Ancient Dragon (Post 691967)
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” ;)


All times are GMT -4. The time now is 5:42 pm.

Forum system based on vBulletin Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
©2003 - 2010 DaniWeb® LLC