Shows how to use xtd::startup class.
#include <xtd/console>
#include <xtd/startup>
namespace main_example {
class program {
public:
auto number = 0;
if (args.
size() != 1 || try_parse(args[0], number) ==
false || number < 0 || number > 20) {
console::write_line("Please enter an integer argument betwween 0 and 20.");
console::write_line("Usage: factorial <integer>");
return -1;
}
console::write_line("The factorial of {} is {}", number, [&] {
auto result = 1l;
for (auto i = 1; i <= number; ++i)
result *= i;
return result;
}());
return 0;
}
};
}
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.h:71
virtual size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(xtd::collections::generic::list::...
Definition list.h:364
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.h:175
The xtd::collections::specialized namespace contains specialized and strongly-typed collections; for ...
Definition string_collection.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10