thanks alot
if I use it correctly, the result should be like this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
#define sc ;
int main ()
{
int x sc
std :: cout << "Enter number \n" sc
std :: cin >> x sc
std :: cout << "The result = : " << x * x << std :: endl sc
return 0 sc
}
This seems to be a pretty flawed challenge with many possible solutions.
I'd say the biggest issue is that they all depend on the program before pre-processing. iostream has plenty of semi-colons in it when expanded, as would the rest of your code. Another way that works on the same general loophole to do this is
1 2 3 4 5 6 7 8 9 10 11
// another file
#include <iostream>
usingnamespace std;
int cheat() {
int x;
cout << "x=" << endl;
cin >> x;
cout << "x*x = " << x * x << endl;
return 0;
}
1 2 3 4 5 6
// the "real" file
#include "file1.cpp" //should really be a header/cpp pair in real programming, but we don't need that here
int main(int argc, char** argv) {
return cheat();
}