Computer Hope
Software => Computer programming => Topic started by: 50m3R3%31 on April 21, 2008, 12:05:01 AM
-
This is some really funny code (although you have to open it at the command prompt). Call the file stop.
#include <stdio.h>
_______________________________________ _______________________________________ ________
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 (http://www.computerhope.com/forum/index.php/topic,55514.0.html), your snippet will not compile.
#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!)
8)
-
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."