Answer» This is some really funny code (although you have to open it at the COMMAND prompt). CALL the file stop.
#include
_______________________________________ _______________________________________ ________ int main() { printf("Cannot stop: Bad mood error.") return(0) }
_______________________________________ _______________________________________ ________
Har har!Not to be critical and notwithstanding your claim of not being a noob, your snippet will not compile.
Code: [Select]#include <stdio.h>
int main() { printf("Cannot stop: Bad mood error."); return(0); }
As I read in another post, attention to detail is critical in programming (no matter how you spell it!)
Is that a loop which reprints "Cannot stop: bad mood error."?
looks like that was the intention- but as it stands it will just show it once and go back to the prompt.
heres one that simulates the prompt.... I made it in VC++ 6- other compilers will likely require the removal of the stdafx line I believe. well here it is.
#include "stdafx.h" #include <string.h> #include <iostream.h> int main(int argc, char* argv[]) { char cmdline[128]; char crlf[7]="\0xD\0xA"; int currmsg=-1; do { currmsg++; COUT << endl; printf("C:\\>",crlf); gets(cmdline); cout << endl; if (currmsg==0) printf("An Error occured processing a token in command line '%s'.%s A Possible reason may be you smell.",cmdline,crlf); else if (currmsg==1) printf("Disk error while processing command '%s'. Ensure you have applied sufficient deodorant to prevent your hard disk from being offended.",cmdline); else if (currmsg==2) printf("I was just about to execute your command, '%s', but changed my mind at the last second.",cmdline); else if (currmsg==3) printf("hey, stop telling me what to do. I'm not going to perform a '%s' just for you.",cmdline); else if (currmsg==4) { printf("crap, it worked this time."); for(int i=0;i<15;i++) { printf("."); } printf("whew, something bad happened when I tried."); } else if (currmsg==5) { printf("for gods sake, I thought you'd give up already!"); currmsg=-1; } printf(crlf); } while (stricmp("quit",cmdline)!=0); printf("%s%sdarn, you said the secret word. oh well.",cmdline); return 0; }
pls SND me c code for "everyone is having interest in rearrangements. find all the rearrangements possible with 0-9 digits without repetition of digit in number and count them. the number should contain distinct digit. the number should not start from 0."
|