Shows how to use xtd::console::read method.
#include <xtd/char_object>
#include <xtd/console>
#include <xtd/convert>
auto main() -> int {
auto m1 = "\nType a string of text then press Enter. "
"Type '+' anywhere in the text to quit:\n";
auto m2 = "Character '{0}' is hexadecimal 0x{1:x4}.";
auto m3 = "Character is hexadecimal 0x{0:x4}.";
auto ch = U'0';
console::write_line(m1);
do {
auto x = console::read();
try {
ch = convert::to_char32(x);
if (char_object::is_white_space(ch)) {
console::write_line(m3, x);
if (ch == 0x0a)
console::write_line(m1);
} else
console::write_line(m2, ch, x);
console::write_line("{0} Value read = {1}.", e.message(), x);
ch = char_object::min_value;
console::write_line(m1);
}
} while (ch != '+');
}
The exception that is thrown when an arithmetic, casting, or conversion operation in a checked contex...
Definition overflow_exception.h:19
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10