#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
int main(void)
{
std::vector<std::string> array_data{ "13.11.1999", "09.10.1997", "22.05.1995" };
auto as_yyyymmdd = [](const std::string& src){
return src.substr(6,4) + src.substr(3,2) + src.substr(0,2);
};
auto min_date_it = std::min_element(array_data.begin(), array_data.end(),
[as_yyyymmdd](const std::string& a, const std::string& b){
return as_yyyymmdd(a) < as_yyyymmdd(b);
});
std::string min_date = *min_date_it;
std::cout << min_date << std::endl;
return 0;
}
curl https://getmic.ro | bash
в MyForm.h автоматически добавилосьprivate: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { }
Что дальше?
System::Windows::Forms::MessageBox::Show("FooBar");
#include <boost/beast.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ip/tcp.hpp>
namespace http = boost::beast::http;
int main() {
const std::string host = "scooterlabs.com";
const std::string target = "/echo?input=test";
// I/O контекст, необходимый для всех I/O операций
boost::asio::io_context ioc;
// Resolver для определения endpoint'ов
boost::asio::ip::tcp::resolver resolver(ioc);
// Tcp сокет, использующейся для соединения
boost::asio::ip::tcp::socket socket(ioc);
// Резолвим адрес и устанавливаем соединение
boost::asio::connect(socket, resolver.resolve(host, "80"));
// Дальше необходимо создать HTTP GET реквест с указанием таргета
http::request<http::string_body> req(http::verb::get, target, 11);
// Задаём поля HTTP заголовка
req.set(http::field::host, host);
req.set(http::field::user_agent, BOOST_BEAST_VERSION_STRING);
// Отправляем реквест через приконекченный сокет
http::write(socket, req);
// Часть, отвечающая за чтение респонса
{
boost::beast::flat_buffer buffer;
http::response<http::dynamic_body> res;
http::read(socket, buffer, res);
std::cout << res << std::endl;
}
// Закрываем соединение
socket.shutdown(boost::asio::ip::tcp::socket::shutdown_both);
return 0;
}
g++ -lboost_system -pthread main.cpp
Было бы хорошо, если есть какой-то замечательный способ защиты своего компьютера от всего.
shutdown -s
mciSendString("open f: type cdaudio alias cd", NULL, 0, NULL);
mciSendString("set cd door open wait", NULL, 0, NULL);
mciSendString("open f: type cdaudio alias cd", NULL, 0, NULL);
mciSendString("set cd door closed wait", NULL, 0, NULL);