0

Is it possible to shorten commands such as cout, cin, etc?

For example can I change cout to like c?

10th Feb 2017, 7:47 PM
Ali Odtallah
Ali Odtallah - avatar
3 Respostas
+ 2
Yes, in fact. Try something like this: #include <iostream> #define c cout using namespace std; int main(){ c << "Hello, World!" << endl; return 0; }
10th Feb 2017, 7:55 PM
DaemonThread
DaemonThread - avatar
0
so the command is #define (variable) (command)?
10th Feb 2017, 8:14 PM
Ali Odtallah
Ali Odtallah - avatar
0
Not just commands. You can do this with pretty much anything. If you felt like replacing semicolons with "semi" for some reason, you could write: #define semi ;
10th Feb 2017, 8:58 PM
DaemonThread
DaemonThread - avatar