Skip to content

Commit

Permalink
feat: Submit Wgtteol's homework_2.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sugar0612 committed Aug 14, 2023
1 parent 73ca201 commit 6c76d7b
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/群友提交/第二题/Wgtteol.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include <iostream>
#include <format>
#include <numbers>
/*
struct X {
size_t operator() (size_t n) {
return n;
}
};
X operator ""_f(const char* str_c, size_t n)
{
return {};
}
*/

auto operator ""_f(const char* str_c, size_t n)
{
return [=] (auto&& ...elems)
{
return std::vformat(str_c, std::make_format_args(elems...));
};
}

int main() {
//std::cerr << "12345xyz"_f(13) << std::endl;
std::cout << "ÀÖ :{} *\n"_f(5);
std::cout << "ÀÖ :{0} {0} *\n"_f(5);
std::cout << "ÀÖ :{:b} *\n"_f(0b01010101);
std::cout << "{:*<10}"_f("¬ɪ");
std::cout << '\n';
int n{};
std::cin >> n;
std::cout << "¦Ð£º{:.{}f}\n"_f(std::numbers::pi_v<double>, n);
}

0 comments on commit 6c76d7b

Please sign in to comment.