A python module that makes c++ print syntax just work, for some reason.
First, import the module like so:
from cprint import *
After that, anything is possible! Just kidding - only one very specific and unhelpful thing is possible that wasn't possible before!
You can now use the following syntax in python:
cout << "Hello " << "World" << endl;
Hello World
There's a catch or two, though.
- To actually print to the screen,
endl
must be called. For example:
cout << "test";
This won't print anything. However,
cout << "test" << endl;
will print the string "test".
endl
doesn't need to be inline, though:
cout << "test";
cout << endl;
will also print the string "test".
- The semicolon is not required, but encouraged. If you're going to take the time to import and use a module that is essentially useless, you should at least go the extra mile to make sure that your experience is as genuine and authentic as possible. The semicolon is the cherry on top.
I still haven't figured out how to package and distribute python modules as of yet, so for now, just download or copy and paste the code into a file called cprint.py and import it as shown above.
If you think there's a way to expand upon my code, let me know. I'm willing to make this thing worse than it already is.