My knowledge of C is pretty much nonexistent, but the way that that code reads to me is that if the answer contains the letter ‘t’ it will say fail. So, even if they do reply with ‘tits’ it still says fail at them.
Now, if I’ve read this right, and by all means I’m not sure I have… As I said, I have very little knowledge of C coding, but if I’ve read it right, then this = fail
Sorry Ronwe, the way it works is if the answer doesn’t start with the character ‘t’ it fails. Ifsofacto, turds would be win in this case. Methinks Sudden_Urge needs to go back to school and learn some regex before he can win.
I will revel in my nerdiness and point out that this bit of code would never compile because main needs to return an int. Also, the variable “ans” should be type “char”, not type “int”, although it might be possible that getchar() is storing the integer ASCII value for the letter, but then the conditional statement wouldn’t be valid. Obviously, I’ve made my point about the level of my nerd-dom.
Lord_Gorlock:
“Also, the variable “ans†should be type “charâ€Â, not type “intâ€Â, although it might be possible that getchar() is storing the integer ASCII value for the letter, but then the conditional statement wouldn’t be valid.”
Actually, that part is fine.
getchar returns the ASCII value. ‘t’ is the ASCII value of the letter t, so ‘t’ == 116 == 0x74.
Also, a char is just an 8-bit integer. You can assign numbers to a char just as you can assign letters to an int. You can also compare ints to letters just as you can compare chars to numbers. They’re all numbers.
Basically, it works.
Ronwe:
“but the way that that code reads to me is that if the answer contains the letter ‘t’ it will say fail.”
That’s the most manly bit of code I have ever seen. Shit that’s Goddamn Batmanly. Win.
S0 boobies fail as well?
I think not.
Tits can not fail.
Exception: National Geographic tits.
My knowledge of C is pretty much nonexistent, but the way that that code reads to me is that if the answer contains the letter ‘t’ it will say fail. So, even if they do reply with ‘tits’ it still says fail at them.
Now, if I’ve read this right, and by all means I’m not sure I have… As I said, I have very little knowledge of C coding, but if I’ve read it right, then this = fail
Sorry Ronwe, the way it works is if the answer doesn’t start with the character ‘t’ it fails. Ifsofacto, turds would be win in this case. Methinks Sudden_Urge needs to go back to school and learn some regex before he can win.
I will revel in my nerdiness and point out that this bit of code would never compile because main needs to return an int. Also, the variable “ans” should be type “char”, not type “int”, although it might be possible that getchar() is storing the integer ASCII value for the letter, but then the conditional statement wouldn’t be valid. Obviously, I’ve made my point about the level of my nerd-dom.
All that said, the post is still hilarious.
^^^ Wow, I just barely understand what you’re saying
@... angrymatt
Regular expressions ftw. The code is sloppy and therefore not as “Win” as it could be.
@... Lord_Gorlock
Yeah, there isn’t a reason why main() should return anything in this case. It should be void. And the var type inconsistencies are lame.
OK Perl golfers.. lets see a 1 liner..
@... Stolid
And that is what I need to learn, and master, Perl.
So, what is the code in Perl? In one line, of course.
Lord_Gorlock:
“Also, the variable “ans†should be type “charâ€Â, not type “intâ€Â, although it might be possible that getchar() is storing the integer ASCII value for the letter, but then the conditional statement wouldn’t be valid.”
Actually, that part is fine.
getchar returns the ASCII value. ‘t’ is the ASCII value of the letter t, so ‘t’ == 116 == 0x74.
Also, a char is just an 8-bit integer. You can assign numbers to a char just as you can assign letters to an int. You can also compare ints to letters just as you can compare chars to numbers. They’re all numbers.
Basically, it works.
Ronwe:
“but the way that that code reads to me is that if the answer contains the letter ‘t’ it will say fail.”
!= is “not equal to”, not “equal to”.
@goatsgomoo
Yeah, I realized my error in this later. Still, if you only need 8 bits, use an 8-bit data type :-p.
Wow, critiquing fake code. I really need to find a better hobby :-D.
Nerds…
You are so fucking hilarious.
LOL wow… I’m glad my self restraint paid off… I was sorely tempted to join in the nerdfest of phail…