Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///////////////////////////////////////////////////////////////////////////////////////////////// Funcs.cpp
- #include <iostream>
- #include <limits>
- using namespace std;
- void printChar()
- {
- for (int i = static_cast<int>(numeric_limits<char>::min()); i <= static_cast<int>(numeric_limits<char>::max()); i++)
- {
- cout << i << "\t-->\t" << static_cast<char>(i) << endl;
- }
- }
- void printUnsignedChar()
- {
- for (int i = static_cast<int>(numeric_limits<unsigned char>::min()); i <= static_cast<int>(numeric_limits<unsigned char>::max()); i++)
- {
- cout << i << "\t-->\t" << static_cast<char>(i) << endl;
- }
- }
- int start()
- {
- setlocale(LC_ALL, "RU");
- int a;
- cout << "1.Таблица char\n2.Таблица unsigned char\n\nКакую таблицу вы хотите получить: ";
- cin >> a;
- return a;
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////////////////////// Funcs.h
- #ifndef FUNCS_H // или #programa once
- #define FUNCS_H
- void printChar();
- void printUnsignedChar();
- int start();
- #endif
- /////////////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////////////////////// Main.cpp
- #include <iostream>
- #include <limits>
- #include "Funcs.h"
- using namespace std;
- int main()
- {
- int a = start();
- while (a > 2)
- {
- a = start();
- }
- switch (a)
- {
- case 1:
- printChar();
- break;
- case 2:
- printUnsignedChar();
- break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement