Well, you could program it to always be honest, I think...
#include <stdio.h>
void main()
{
char in[128], *out="Honestly, I do not know.";
int L;
printf("Ask me something: ");
fgets(in, sizeof(in), stdin);
for(L=0; in[L]!='\0'; ++L); in[L-1]='\0';
printf("You asked me, \"%s\"\n%s\n",in, out);
}
What do you think?
Hey, what do you think of my C code to get rid of carriage returns?
The variable name "L" stands for Length. Another way to do this
is the function strlen(), but then I have to include the string.h file.
I like to keep it simple.
for(L=0; in[L]!='\0'; ++L); in[L-1]='\0';
PROGRAM OUTPUT:
Ask me something: What is the meaning of life?
You asked me, "What is the meaning of life?"
Honestly, I do not know.
@Freddy: It seems the bbcode, for the [ code ] tag is not fully enabled (the Select link selects nothing).
And, while you are at it, syntax highlighting is also not enabled, it seems.