Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 435 Bytes

Calculator.md

File metadata and controls

26 lines (20 loc) · 435 Bytes

電卓

電卓

# include <Siv3D.hpp>

void Main()
{
	Graphics::SetBackground(Color(240));

	const Font font(40);

	String expression;

	while (System::Update())
	{
		Input::GetCharsHelper(expression);

		font(expression).draw(10, 10, Palette::Black);

		if (const auto result = EvaluateOpt(expression))
		{
			font(result.value()).draw(10, 250, Palette::Black);
		}
	}
}