xtd 0.2.0
console_in_out.cpp

Shows how to use xtd::console::in and xtd::console::out streams.

#include <xtd/console>
#include <xtd/environment>
using namespace xtd;
auto main() -> int {
auto& is = console::in;
auto& os = console::out;
os << "Ola Mundo!" << environment::new_line;
os << "What is your name: ";
auto name = string::empty_string;
is >> name;
os << "Buenos Dias, " << name << environment::new_line;
}
// This code produces the following output :
//
// Ola Mundo!
// What is your name: James
// Buenos Dias, James!
static std::istream in
Gets the standard input stream. A std::basic_istream<char_t> that represents the standard input strea...
Definition console.hpp:47
static std::ostream out
Gets the standard output stream. A std::basic_ostream<char_t> that represents the standard output str...
Definition console.hpp:52
static xtd::string new_line() noexcept
Gets the newline string defined for this environment.
bool is(xtd::any value)
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:485
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8