Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <limits>
- using namespace std;
- void closureMin(int, int def = 3)
- {
- cout << "\n\nInt на минимальном значении: \n";
- for (int i = def; i >= -def; i--) // на минимальном
- {
- if (i >= 0)
- cout << static_cast<int>(numeric_limits<int>::min()) << "+" << i << " = " << static_cast<int>(numeric_limits<int>::min() + i) << endl;
- else if (i < 0)
- cout << static_cast<int>(numeric_limits<int>::min()) << i << " = " << static_cast<int>(numeric_limits<int>::min() - i) << endl;
- }
- cout << "\nInt на максимальном значении: \n";
- for (int i = def; i >= -def; i--) // на максимальном
- {
- if (i >= 0)
- cout << static_cast<int>(numeric_limits<int>::max()) << "+" << i << " = " << static_cast<int>(numeric_limits<int>::max() + i) << endl;
- else if (i < 0)
- cout << static_cast<int>(numeric_limits<int>::max()) << i << " = " << static_cast<int>(numeric_limits<int>::max() - i) << endl;
- }
- }
- void closureMin(char, int def = 3)
- {
- cout << "\n\nChar на минимальном значении: \n";
- for (int i = def; i >= -def; i--) // на минимальном
- {
- if (i >= 0)
- cout << static_cast<int>(numeric_limits<char>::min()) << "+" << i << " = " << static_cast<int>(numeric_limits<char>::min() + i) << endl;
- else if (i < 0)
- cout << static_cast<int>(numeric_limits<char>::min()) << i << " = " << static_cast<int>(numeric_limits<char>::min() - i) << endl;
- }
- cout << "\nChar на максимальном значении: \n";
- for (int i = def; i >= -def; i--) // на максимальном
- {
- if (i >= 0)
- cout << static_cast<int>(numeric_limits<char>::max()) << "+" << i << " = " << static_cast<int>(numeric_limits<char>::max() + i) << endl;
- else if (i < 0)
- cout << static_cast<int>(numeric_limits<char>::max()) << i << " = " << static_cast<int>(numeric_limits<char>::max() - i) << endl;
- }
- }
- //void closureMin( (и так далее) , int def = 3)
- int main()
- {
- setlocale(LC_ALL, "RU");
- int print{ 0 };
- cout << "Введите количество шагов (по дефолту стоит 3): ";
- cin >> print;
- closureMin(int{ 0 }, print);
- closureMin(char{ 0 }, print);
- //closureMin( (и так далее) { 0 }, print);
- return 0;
- }
Advertisement
Comments
-
- //void closureMin( (и так далее) , int def = 3)
- а доделать?
- static_cast<int>(numeric_limits<char>::min() - i)
- вот это для чара замыкание вам не покажет
Add Comment
Please, Sign In to add comment
Advertisement