Skip to content

Premain#1

Open
GERONlMO wants to merge 20 commits into
masterfrom
premain
Open

Premain#1
GERONlMO wants to merge 20 commits into
masterfrom
premain

Conversation

@GERONlMO

Copy link
Copy Markdown
Owner

@UsovaMA

UsovaMA commented Sep 30, 2021

Copy link
Copy Markdown

Подписаться было бы неплохо. Ни одного опознавательного знака нет.

@UsovaMA UsovaMA left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Замечания

Comment on lines +1 to +21
#include <stdio.h>
#include <math.h>

int main() {

float a, b, c;

printf("Vvedite 3 chisla:\na = ");
scanf_s("%f", &a);
printf("b = ");
scanf_s("%f", &b);
printf("c = ");
scanf_s("%f", &c);

float Result;

Result = (a + b + c) / 3;

printf("Resultat = %.2f", Result);

} No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Эти три задачи должны быть не 3-мя разными проектами, а аккуратно объединены в один проект. Всё в одной функции main().
Аналогично для задач с площадями. Для них один проект и одна функция main()

Когда начнёшь делать изменения, понадобится к коммитам добавлять удаление каких-то файлов, для этого понадобится команда
git add -u

Comment on lines +43 to +56
printf("����� �� ����� ������� �� ������ ������\n");
printf("�����:\n");
if (count_King_da > 0) {
printf("������\n");
}
if (count_Rook_da > 0) {
printf("�����\n");
}
if (count_Bishop_da > 0) {
printf("����\n");
}
if (count_Knight_da > 0) {
printf("����\n");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Эту часть во всех фигурах лучше вынести в самый конец, на этом месте оставить флаг, что фигура выбранная не смогла сходить.
Тогда этого дублирования не будет

Comment on lines +13 to +29
while ((ch = getchar()) != EOF) {
if (ch == '\n') {
break;
}
if (ch == ' ' || ch == '\t')
flag = -1;
else if (flag == -1) {
if (ch == '0' || ch == '1' || ch == '2' || ch == '3' || ch == '4' || ch == '5' || ch == '6' || ch == '7' || ch == '8' || ch == '9'){
flag = 1;
numbers++;
}
else
{
flag = 1;
words++;
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Что при такой реализации будет, если пользовать в тексте использует знаки &%^$ и прочие?

@GERONlMO

GERONlMO commented Oct 1, 2021

Copy link
Copy Markdown
Owner Author

@UsovaMA Здравствуйте! Это Новостроев Иван. Добавил задачу на инверсию

Comment on lines +59 to +64
do {
result = result * 10 + number % 10;
number = number / 10;
} while (number);

printf("��������� �������� : %d\n", result);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

От такого дублирования сильного лучше избавиться. Например:

while (isWork) {
        printf("...");
        scanf_s("%d", &VariantOfProg);
        int changeMode = 0;
        while (!changeMode) {
            int isError = 0;
	    do {
		    if (isError)
			    printf("...; Введите -1 для возврата к выбору режима.");
    
		    printf("...");
		    scanf_s("%d", &number);
    
		    if (number == 0) {
			    isWork = 0;
			    printf("...");
			    break;
		    } else if (number == -1) {
                            changeMode = 1;
                            break;
                    }
		    isError = (number < 0);
    
	    } while (isError);

            if (changeMode || !isWork) break;

            switch(VariantOfProg) {
                  case 1:
                         do {
					result = result * 10 + number % 10;
					number = number / 10;
		          } while (number);
                          break;
                  case 2:
               		  do {
					result = result + number % 10;
					number = number / 10;
			  } while (number);
                          break;
                  default:
                          break;
            }
            printf("...: %d\n", result);
}

Можно своё решение придумать избавления от дублирования.

@GERONlMO

GERONlMO commented Oct 7, 2021

Copy link
Copy Markdown
Owner Author

@UsovaMA Здравствуйте! Это Иван Новостроев, исправил все замечания

@UsovaMA

UsovaMA commented Oct 12, 2021

Copy link
Copy Markdown

Все исправления приняты

@GERONlMO

Copy link
Copy Markdown
Owner Author

@UsovaMA Почти работающая самостоятельная работа, 5 мин и она заработает :)

@GERONlMO

GERONlMO commented Oct 5, 2022

Copy link
Copy Markdown
Owner Author

@UsovaMA Добавил решение на 2 лабу

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.

3 participants