xtd 0.2.0
console_beep3.cpp

Shows how to use xtd::console::beep method.

#include <xtd/threading/thread>
#include <xtd/beep>
#include <xtd/console>
#include <xtd/environment>
#include <xtd/int32_object>
using namespace xtd;
auto main(int argc, char* argv[]) -> int {
int x = 0;
//
if ((argc == 2) && (int32_object::try_parse(argv[1], x) == true) && ((x >= 1) && (x <= 9))) {
for (auto i = 1; i <= x; i++) {
console::out << string::format("Beep number {}.", i) << beep() << environment::new_line;
}
} else
console::out << "Usage: Enter the number of times (between 1 and 9) to beep." << environment::new_line;
}
Represent beep output manipulator class.
Definition beep.hpp:21
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.
static void sleep(int32 milliseconds_timeout)
Suspends the current thread for a specified time.
@ i
The I key.
Definition console_key.hpp:104
@ x
The X key.
Definition console_key.hpp:134
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
static bool try_parse(const xtd::string &value, reference result) noexcept
Converts the string to its value_type equivalent. A return value indicates whether the conversion suc...
Definition box.hpp:172