Skip to content

コンソール出力

Kasugaccho edited this page Aug 9, 2019 · 14 revisions

コンソール出力

2値化文字出力 [OutputStringBool]

ソースコード

#include <DTL.hpp>
#include <cstddef>
#include <cstdint>
#include <array>

int main() {

	using shape_t = std::uint_fast8_t;
	constexpr std::size_t width{ 15 };
	constexpr std::size_t height{ 7 };

	std::array<std::array<shape_t, width>, height> matrix{ {} };

	dtl::shape::PointGridWithBorder<shape_t>(1, 2).draw(matrix);

	dtl::console::OutputStringBool<shape_t>("#", "/").draw(matrix);

}

出力結果

###############
#/////////////#
#/#/#/#/#/#/#/#
#/////////////#
#/#/#/#/#/#/#/#
#/////////////#
###############

文字出力 [OutputString]

ソースコード

#include <DTL.hpp>
#include <cstddef>
#include <cstdint>
#include <array>

int main() {

	using shape_t = std::uint_fast8_t;
	constexpr std::size_t width{ 15 };
	constexpr std::size_t height{ 7 };

	std::array<std::array<shape_t, width>, height> matrix{ {} };

	dtl::shape::PointGridWithBorder<shape_t>(1, 2).draw(matrix);

	dtl::console::OutputString<shape_t>("/", "#", "%").draw(matrix);

}

出力結果

%%%%%%%%%%%%%%%
%/////////////%
%/#/#/#/#/#/#/%
%/////////////%
%/#/#/#/#/#/#/%
%/////////////%
%%%%%%%%%%%%%%%

数値出力 [OutputNumber]

ソースコード

#include <DTL.hpp>
#include <cstddef>
#include <cstdint>
#include <array>

int main() {

	using shape_t = std::uint_fast8_t;
	constexpr std::size_t width{ 15 };
	constexpr std::size_t height{ 7 };

	std::array<std::array<shape_t, width>, height> matrix{ {} };

	dtl::shape::PointGridWithBorder<shape_t>(1, 2).draw(matrix);

	dtl::console::OutputNumber<shape_t>().draw(matrix);

}

出力結果

222222222222222
200000000000002
201010101010102
200000000000002
201010101010102
200000000000002
222222222222222

ソースコード

#include <DTL.hpp>
#include <cstddef>
#include <cstdint>
#include <array>

int main() {

	using shape_t = std::uint_fast8_t;
	constexpr std::size_t width{ 15 };
	constexpr std::size_t height{ 7 };

	std::array<std::array<shape_t, width>, height> matrix{ {} };

	dtl::shape::PointGridWithBorder<shape_t>(1, 2).draw(matrix);

	dtl::console::OutputNumber<shape_t>(",").draw(matrix);

}

出力結果

2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,1,0,1,0,1,0,1,0,1,0,1,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,1,0,1,0,1,0,1,0,1,0,1,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,

ソースコード

#include <DTL.hpp>
#include <cstddef>
#include <cstdint>
#include <array>

int main() {

	using shape_t = std::uint_fast8_t;
	constexpr std::size_t width{ 15 };
	constexpr std::size_t height{ 7 };

	std::array<std::array<shape_t, width>, height> matrix{ {} };

	dtl::shape::PointGridWithBorder<shape_t>(1, 2).draw(matrix);

	dtl::console::OutputNumber<shape_t>(" [", "],").draw(matrix);

}

出力結果

 [2], [2], [2], [2], [2], [2], [2], [2], [2], [2], [2], [2], [2], [2], [2],
 [2], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [2],
 [2], [0], [1], [0], [1], [0], [1], [0], [1], [0], [1], [0], [1], [0], [2],
 [2], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [2],
 [2], [0], [1], [0], [1], [0], [1], [0], [1], [0], [1], [0], [1], [0], [2],
 [2], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [2],
 [2], [2], [2], [2], [2], [2], [2], [2], [2], [2], [2], [2], [2], [2], [2],
Clone this wiki locally