+ 2
Does #define work?
Hey, i was wondering, does #define work? I tried many times to define cin as something else but it doesn't work. I also code on PC and I use it quite often so that's why I asked. Can anyome help me?
7 odpowiedzi
+ 8
@MEDO capra
The problem is with your code, not the #define directive.
cin<<x is invalid, it should have been cin>>x.
Thus, replace your #define with this one:
#define in(x) cin>>x
+ 23
Some statement are work.😕
https://code.sololearn.com/cQSX65HvudM6/?ref=app
+ 20
A funny example!
#include <iostream>
using namespace std;
#define br cout << endl
int main()
{
cout << "MEDO capra was a great guy for ";
br;
cout << "50 years!";
}
[http://cpp.sh/6m6tb]
+ 19
#include <iostream>
using namespace std;
#define br cout << endl
#define in(x) cin >> x;
int main()
{
int n = 0;
cout << "MEDO capra was a great guy for ";
br;
cout << "50 years!"; br;
cout << "How many tears?! "; in(n);
cout << "Ahhhh... " << n << " years";
}
:DDDDD
+ 2
Well thanks but I meant to say if it works in the Solo Learn playground.
+ 2
Well... if you define cin as something else it doesn't work
https://code.sololearn.com/cNtZ8aB7PIbY/?ref=app