Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab2 #1133

Closed
wants to merge 17 commits into from
Closed

Lab2 #1133

wants to merge 17 commits into from

Conversation

VasilinaUganova
Copy link

No description provided.

Lab2C/lab2.c Outdated
int main() {

FILE* input_file = fopen("input.txt", "r");
FILE* output_file = fopen("output.txt", "w");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно открывать файлы, переданные в качестве параметров.

set(INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/input.txt)
set(OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/output.txt)

add_test(NAME TestLab2C COMMAND Lab2C ${CMAKE_CURRENT_BINARY_DIR}/input.txt ${CMAKE_CURRENT_BINARY_DIR}/output.txt)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Входной файл можно передавать прямо из исходного каталога, не обязательно его копировать.

Lab2C/lab2.c Outdated
#include "stack.h"

bool is_matching_tag(const char* opening, const char* closing) {
return strcmp(opening + 1, closing + 2) == 0;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не учитывается, что строки могут быть в разном регистре.

Василина Юганова added 3 commits November 27, 2024 01:32
target_include_directories(Lab2C PUBLIC ../LibraryC)
target_link_libraries(Lab2C LibraryC)

add_test(NAME TestLab2C COMMAND Lab2C ${CMAKE_CURRENT_SOURCE_DIR}/input.txt ${CMAKE_CURRENT_SOURCE_DIR}/output.txt)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Выходной файл не должен находиться в каталоге с исходниками.

Lab2C/output.txt Outdated
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Этот файл не нужен в репозитории.

@Dovgalyuk
Copy link
Owner

Принято.

  • Реализовать в проекте Library модуль vector для массива переменного размера и очередь на основе этого модуля (модуль queue). Массив расширяется, если в очереди становится слишком много элементов.
  • Решить задачу, используя реализованную очередь.
  • Добавить пример входных данных и описать тест в CMakeLists.txt, который запускает разработанную программу и использует входные данные.

В первой строке входного файла записаны числа N и M - высота и ширина прямоугольной доски. На ней расположены несколько клеток (координаты (от 1 до N и от 1 до M) которых записаны в следующих строках), покрашенные в цвет с интенсивностью 1. Далее делается несколько ходов. На каждом ходу все пустые клетки, граничащие с другими клетками с интенсивностью k, красятся в цвет k+1. Написать программу, использующую очередь, для определения того, в какое количество цветов будет покрашена вся доска.

Входные данные

3 3
1 1

Выходные данные

5

@Dovgalyuk Dovgalyuk closed this Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants