/
lyapdy
/
Object_oriented_programming_cpp_318
Обзор
Документация
Войти
/
lyapdy
/
Object_oriented_programming_cpp_318
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
lab4/task_5.cpp
79 строк
2 KB
danillyapunov
task4
25 июн 2025, 18:15
25 июн 2025, 18:15
4f23491
Код
Авторство
О чём код?
#include <iostream> #include "task_5.h" void task_5(){ int option = 0; std::cout << "������ ���� �� ����� ��樨 ��� �ନ���� ���ᨢ� (0 - char, 1 - short, 2 - int, 3 - float, 4 - double): "; while(!(std::cin>> option) ^ ((option < 0) || (option > 4)) || (isdigit(option))) { std::cout << "������ ���� �� ����� ��樨 ��� �ନ���� ���ᨢ� (0 - char, 1 - short, 2 - int, 3 - float, 4 - double): "; // ����� ����� std::cin.clear(); std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); } //TODO: ��������� �� ��樨 0 (�㦭� ������� ��樨 1, 2, 3, 4) � ���饬 const int size = 10; switch(option) { case 0: { char carray[size]{}; fillArr(carray, size); std::cout << "��室�� ���ᨢ: \t"; printArr(carray, size); bubbleSort(carray, size); std::cout << "��������� ���ᨢ: "; printArr(carray, size); break; } case 1: { short sarray[size]{}; fillArr(sarray, size); std::cout << "��室�� ���ᨢ: \t"; printArr(sarray, size); bubbleSort(sarray, size); std::cout << "��������� ���ᨢ: "; printArr(sarray, size); break; } case 2: { int iarray[size]{}; fillArr(iarray, size); std::cout << "��室�� ���ᨢ: \t"; printArr(iarray, size); bubbleSort(iarray, size); std::cout << "��������� ���ᨢ: "; printArr(iarray, size); break; } case 3: { float farray[size]{}; fillArr(farray, size); std::cout << "��室�� ���ᨢ: \t"; printArr(farray, size); bubbleSort(farray, size); std::cout << "��������� ���ᨢ: "; printArr(farray, size); break; } case 4: { double darray[size]{}; fillArr(darray, size); std::cout << "��室�� ���ᨢ: \t"; printArr(darray, size); bubbleSort(darray, size); std::cout << "��������� ���ᨢ: "; printArr(darray, size); break; } default: { std::cout << "�訡�� �����" << '\n'; break; } } }