fork(1) download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public struct Rational
  6. {
  7. private long numerator;
  8. private long denominator;
  9.  
  10. public Rational(long num = 0, long denom = 1) // This is allowed!!!
  11. {
  12. numerator = num;
  13. denominator = denom;
  14. }
  15.  
  16. override public string ToString() {
  17. return (numerator/(1.0*denominator)).ToString();
  18. }
  19. }
  20.  
  21. public static void Main()
  22. {
  23. Console.WriteLine(new Rational());
  24. Console.WriteLine(new Rational(42));
  25. }
  26. }
Success #stdin #stdout 0.02s 14848KB
stdin
Standard input is empty
stdout
NaN
42