-
-
Save orange-in-space/fd1ed602ddfa6a9aaf53a5f741158cfb to your computer and use it in GitHub Desktop.
コメント行を削除しちゃうと上手く動かないふしぎな計算機><;(一発ギャグ)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class Nandakore{ | |
public static void Main(){ | |
// | |
// | |
// コメント行を削除しちゃうと上手く動かないふしぎな計算機><;(一発ギャグ) | |
NazoMachine nazo = new NazoMachine(); | |
// | |
nazo.Add(); | |
nazo.Add(); | |
nazo.Add(); | |
// | |
// | |
nazo.Add(); | |
nazo.Add(); | |
// | |
nazo.Sub(); | |
Console.WriteLine(@"Answer to the Ultimate Question of Life, the Universe, and Everything="); | |
Console.WriteLine(nazo.ToString()); | |
} | |
public class NazoMachine | |
{ | |
private int m_value = 0; | |
public NazoMachine() | |
{ | |
} | |
private NazoMachine(int v) | |
{ | |
m_value = v; | |
} | |
public override string ToString() | |
{ | |
return m_value.ToString(); | |
} | |
public void Add([System.Runtime.CompilerServices.CallerLineNumber] int n = 0) | |
{ | |
m_value += n; | |
} | |
public void Sub([System.Runtime.CompilerServices.CallerLineNumber] int n = 0) | |
{ | |
m_value -= n; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment