Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -60,7 +60,7 @@ CODE_SNIPPETS = [
|
|
60 |
"size_t countWordsInFile(const std::string& filename) { std::ifstream file(filename); std::string word; size_t count = 0; while (file >> word) count++; return count; }",
|
61 |
"bool isLeapYear(int year) { return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); }",
|
62 |
"std::string formatTime(const std::string& format) { char buffer[80]; time_t now = time(0); strftime(buffer, sizeof(buffer), format.c_str(), localtime(&now)); return buffer; }",
|
63 |
-
"int daysBetweenDates(const std::string& date1, const std::string& date2) { struct tm tm1 = {}, tm2 = {}; strptime(date1.c_str(), \"%Y-%m-%d\", &tm1); strptime(date2.c_str(), "%Y-%m-%d", &tm2); time_t time1 = mktime(&tm1), time2 = mktime(&tm2); return difftime(time2, time1) / (60 * 60 * 24); }",
|
64 |
"std::string getCurrentWorkingDirectory() { char buffer[FILENAME_MAX]; getcwd(buffer, FILENAME_MAX); return buffer; }",
|
65 |
"std::vector<std::string> listFilesInDirectory(const std::string& path) { std::vector<std::string> files; for (const auto& entry : std::filesystem::directory_iterator(path)) files.push_back(entry.path().filename().string()); return files; }",
|
66 |
"void createDirectory(const std::string& path) { std::filesystem::create_directory(path); }",
|
|
|
60 |
"size_t countWordsInFile(const std::string& filename) { std::ifstream file(filename); std::string word; size_t count = 0; while (file >> word) count++; return count; }",
|
61 |
"bool isLeapYear(int year) { return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); }",
|
62 |
"std::string formatTime(const std::string& format) { char buffer[80]; time_t now = time(0); strftime(buffer, sizeof(buffer), format.c_str(), localtime(&now)); return buffer; }",
|
63 |
+
"int daysBetweenDates(const std::string& date1, const std::string& date2) { struct tm tm1 = {}, tm2 = {}; strptime(date1.c_str(), \"%Y-%m-%d\", &tm1); strptime(date2.c_str(), \"%Y-%m-%d\", &tm2); time_t time1 = mktime(&tm1), time2 = mktime(&tm2); return difftime(time2, time1) / (60 * 60 * 24); }",
|
64 |
"std::string getCurrentWorkingDirectory() { char buffer[FILENAME_MAX]; getcwd(buffer, FILENAME_MAX); return buffer; }",
|
65 |
"std::vector<std::string> listFilesInDirectory(const std::string& path) { std::vector<std::string> files; for (const auto& entry : std::filesystem::directory_iterator(path)) files.push_back(entry.path().filename().string()); return files; }",
|
66 |
"void createDirectory(const std::string& path) { std::filesystem::create_directory(path); }",
|