#include #include #include #include using namespace std; extern "C" __declspec(dllexport) int Pow(int num, int exp) { for (int i = 1; i < exp; i++) num *= num; return num; } extern "C" __declspec(dllexport) bool Compare(int a, int b) { return a > b; } extern "C" __declspec(dllexport) double SpeedConverter(double speed, string unit) { if (unit == "kmh") { cout << "Speed in Mile: " << speed * 0.621371 << endl; return speed * 0.621371; } else if (unit == "mph") { cout << "Speed in Km: " << speed * 1.60934 << endl; return speed * 1.60934; } else { cout << "Error speed Type! Unit: kmh or mph!" << endl; return -1; } } extern "C" __declspec(dllexport) wstring FindSmallestFileInFolder() { wstring folderPath; wcout << L"Введите путь к папке: "; wcin >> folderPath; WIN32_FIND_DATA findFileData; HANDLE hFind = FindFirstFile((folderPath + L"\\*").c_str(), &findFileData); wstring smallestFilePath; uintmax_t smallestSize = numeric_limits::max(); if (hFind != INVALID_HANDLE_VALUE) { do { if ((findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) { wstring filePath = folderPath + L"\\" + findFileData.cFileName; uintmax_t fileSize = findFileData.nFileSizeLow; if (fileSize < smallestSize) { smallestSize = fileSize; smallestFilePath = filePath; } } } while (FindNextFile(hFind, &findFileData) != 0); FindClose(hFind); } if (!smallestFilePath.empty()) { wcout << L"Самый маленький файл находится по пути: " << smallestFilePath << endl; } else { wcout << L"В указанной папке нет файлов" << endl; } return smallestFilePath; }