0
Is it possible to shorten commands such as cout, cin, etc?
For example can I change cout to like c?
3 Réponses
+ 2
Yes, in fact. Try something like this:
#include <iostream>
#define c cout
using namespace std;
int main(){
c << "Hello, World!" << endl;
return 0;
}
0
so the command is #define (variable) (command)?
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 ;