| | |
How the hell did i do this! funny as hell
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
run it type hello, press enter then type end in a c ompiler
c Syntax (Toggle Plain Text)
#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]); } } }
Last edited by Ancient Dragon; Sep 15th, 2008 at 11:22 pm. Reason: add line numbers for convenience.
_________________________
||||||||||[][][]|||||||||||||||||||
|||||||||||||||____|
||||||||||
||||||||||
||||||||||[][][]|||||||||||||||||||
|||||||||||||||____|
||||||||||
||||||||||
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).
C Syntax (Toggle Plain Text)
for(i=48; i<size; i--) { if( strcmp(&rev[i], "end") != 0) { printf("%c",rev[i]); } }
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.
>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?
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.
"If it moves, tax it. If it keeps moving, regulate it, and if it stops moving, subsidize it" - Ronald Reagan
•
•
•
•
>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.
![]() |
Similar Threads
- We only give homework help to those who show effort (Computer Science)
- Overheated crash... Ah hell... (Troubleshooting Dead Machines)
- I like this Avatar (Geeks' Lounge)
- Have you registered your fighter/bomber yet? (Geeks' Lounge)
- Random Shutdowns, Excessive Heat, & Funny Noises (Troubleshooting Dead Machines)
- C++ (C++)
- The BEST PC games of all time (Geeks' Lounge)
- Has Acacia threatened to sue you yet? (Geeks' Lounge)
Other Threads in the C Forum
- Previous Thread: pseudocode help!
- Next Thread: Finding Coefficients of a polynomial, roots are provided from command line
Views: 564 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for C
adobe ansi api array arrays bash binarysearch centimeter char convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory drawing dynamic executable fflush file fork frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hardware highest homework i/o inches infiniteloop initialization interest km lazy linked linkedlist linux linuxsegmentationfault list locate logical_drives match matrix meter microsoft motherboard multi mysql open opendocumentformat opensource owf pattern pdf performance pointer pointers posix power problem probleminc program programming pyramidusingturboccodes read recursion recv repetition scanf scheduling segmentationfault send shape socketprograming spoonfeeding stack standard strchr string strings structures student suggestions system systemcall test testautomation unix user visualstudio voidmain() wab win32 win32api windows.h






