My most brilliant code, swapping two variables without having a 3rd temporary variable!
Code:#define swap(a,b) a ^= b ^= a ^= b
My most brilliant code, swapping two variables without having a 3rd temporary variable!
Code:#define swap(a,b) a ^= b ^= a ^= b
Code:#include <vector> #include <windows.h> #include <conio.h> #include <istream> using namespace std; int main() { cout << "See how long it takes you to figure out why this won't work " << endl; return 0; }
what does
^=
mean, i haven't seen that before
#include <istream>Originally posted by Shadow12345
Code:#include <vector> #include <windows.h> #include <conio.h> #include <istream> using namespace std; int main() { cout << "See how long it takes you to figure out why this won't work " << endl; return 0; }
no output streams, that was easy
PHP and XML
Let's talk about SAX
Code:#include <iostream> using namespace std; int main() { cout << "Now you will be really perplexed as to why this one wont' work" << endl; return 0; }
i may be drunk but i did notice the missing std:: namespace declarations on yor cout and endl;s
PHP and XML
Let's talk about SAX
I don't think I have ever written brilliant code. I am at the point that whenever I have a lot of '*' in my code, and do a lot with filestreams, I think I am brilliant, but that is only the newbie part of me that remembers seeing the bigger more mature programmers using '*'s and filestreams.
yeah pointers are hard
once you get how to use them it's great...
for a newb you've gogtat lot of posts dude
PHP and XML
Let's talk about SAX
because it worksOriginally posted by Shadow12345
Code:#include <iostream> using namespace std; int main() { cout << "Now you will be really perplexed as to why this one wont' work" << endl; return 0; }
' should be \'
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
First I thought that, but when I compiled and run the program it was fine, using MSVC++!Originally posted by Sang-drax
' should be \'
Maybe because it's a string, but if you want to put " you will havetouse \", maybe because there is a " before it!
if you are trying to write cout << '\''; you should use \'
If you know why please tell me.
You can use both notations (with or without the \) for a single quote or question mark in a string.
Most brilliant code? How about the worlds smallest program:
Unfortunately, it's not 100% portable.Code:
-Prelude
My best code is written with the delete key.