Skip to content

Instantly share code, notes, and snippets.

@kraftwerk28
Created October 23, 2021 19:16
Show Gist options
  • Save kraftwerk28/24f1ec31e6bc4d4c51536a3bbb7ccb45 to your computer and use it in GitHub Desktop.
Save kraftwerk28/24f1ec31e6bc4d4c51536a3bbb7ccb45 to your computer and use it in GitHub Desktop.
By @gofr from tsoding discord
std=type("",(),{"__getitem__":lambda _,__:__.step})();cout=type("",(),{"__lshift__":lambda _,__:_+print(__,end=""),"__add__":lambda _,__:_})();endl="\n";kw=type("",(),{"__sub__":lambda _,__:_+exec("_.__=str(__)",globals(),locals()),"__add__":lambda _,__:_,"__eq__":lambda _,__:exec("globals()[_.__]=var(__)",globals(),locals())});int=kw();float=kw();string=kw();char=kw();double=kw();unsigned=kw();long=kw();short=kw();struct=type("",(),{"__sub__":lambda _,__:_+exec("_.__=__" if isinstance(__,str) else "globals()[_.__]=struct_type()",globals(),locals()),"__add__":lambda _,__:_})();struct_type=type("",(),{"__add__":lambda _,__:_,"__sub__":lambda _,__:_+exec("globals()[__]=struct_val()",globals(),locals())});struct_val=type("",(),{"__getattr__":lambda _,__:_+exec("_.__dict__[__]=var()\n_.__=__",globals(),locals()),"__add__":lambda _,__:_.__dict__[_.__]});var=type("",(),{"__eq__":lambda _,__:_.__init__(__),"__init__":lambda _,__=None:exec("_.__=__",globals(),locals()),"__pow__":lambda _,__:_,"__repr__":lambda _:str(_.__)});cin=type("",(),{"__rshift__":lambda _,__:__==input()})();stoi=lambda _:__import__("builtins").int(repr(_))
#include <iostream>
#include <string>
struct-"Point"-{
int-"x" == 0,
int-"y" == 0,
};
int-"main()"-{
Point-"point",
std[::cout] << "Type in the x value for point : ",
std[::string]-"temp" == "",
std[::cin] >> temp,
point.x == std[::stoi](temp),
std[::cout] << "Type in the y value for point : ",
std[::string]-"temp" == "",
std[::cin] >> temp,
point.y == std[::stoi](temp),
std[::cout] << "Point 'point':\n X: " << point.x << "\n Y: " << point.y << std[::endl],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment