Skip to content

Comments

Двоичное представление#10

Open
shannami wants to merge 3 commits intomainfrom
BinaryRep
Open

Двоичное представление#10
shannami wants to merge 3 commits intomainfrom
BinaryRep

Conversation

@shannami
Copy link
Owner

@shannami shannami commented Dec 1, 2025

Шалахина Анна дз-12

@shannami shannami requested a review from WoWaster December 1, 2025 20:29
#include "BinaryRep.h"


void Complement(signed char x, int out[]) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Стайлгайд вообще не выдержан. Так же, как и мысли о том, что переменным и аргументам нужно давать не однобуквенные имена

Copy link
Collaborator

Choose a reason for hiding this comment

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

И это какое-то очень странное название для функции

}
}

void PrintBin(int A[]) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Я сюда могу передать массив и 2 и из 122 элементов. Стоит явно обернуть массив нужного размера в структуру.

Copy link
Collaborator

Choose a reason for hiding this comment

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

А ещё массив из bool будет логичнее

Comment on lines +21 to +23
int sum = A[i] + B[i] + carry;
S[i] = sum & 1;
carry = (sum >> 1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Здесь получается не очень честно, потому что у Вас может получиться двойка. А если перейти на язык
электроники, то без этого можно обойтись :) https://en.wikipedia.org/wiki/Adder_(electronics)#Full_adder

}
}

int BinToInt(int A[]) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

А зачем, если Вы везде оперируете с signed char. Кстати, вместо него можно было взять int8_t.



int main() {
int x, y;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Инициализировать значения, всё такое?..

Comment on lines +3 to +6
void Complement(signed char x, int out[]);
void PrintBin(int A[]);
void SumBin(int A[], int B[], int S[]) ;
int BinToInt(int A[]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

А кто будет писать комментарии к тому, что это вообще за функции?!

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