Skip to content

Instantly share code, notes, and snippets.

@ProgramistycznySwir
Last active July 29, 2022 16:27
Show Gist options
  • Save ProgramistycznySwir/628e7575a7a696084aa99813f58c85dc to your computer and use it in GitHub Desktop.
Save ProgramistycznySwir/628e7575a7a696084aa99813f58c85dc to your computer and use it in GitHub Desktop.
I've fixed C#'s I/O by making it as Bjarne Stroustrup intended.
using static System.Console;
namespace NoticeMeSenpai;
public class Program {
const string endl = "\n";
public static int Main() {
S a = "Hello", b = "World!";
C cout, cin, _;
_= cout < a < " " < b < endl;
_= cin > a > b;
_= cout < "a: " < a < endl;
_= cout < "b: " < b < endl;
return 0;
}
public struct C {
public static C operator <(C _0, S _1) { Write(_1); return _0; }
public static C operator >(C _0, S _1) { _1.s = ReadLine(); return _0; }
}
public class S {
public string s;
public S(string s) => this.s = s;
public static S operator <(S _0, S _1) => _0 + _1;
public static S operator >(S _0, S _1) => _0 + _1;
public static implicit operator string(S _0) => _0.s;
public static implicit operator S(string _0) => new(_0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment