Skip to content

2 hw kobzystyi maksym#42

Open
MaksymKobzystyi wants to merge 3 commits intomasterfrom
2HwKobzystyiMaksym
Open

2 hw kobzystyi maksym#42
MaksymKobzystyi wants to merge 3 commits intomasterfrom
2HwKobzystyiMaksym

Conversation

@MaksymKobzystyi
Copy link
Collaborator

No description provided.

int main() {
int number = 0;
cout << "Enter number of ticket ";
cin >> number;
Copy link
Owner

Choose a reason for hiding this comment

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

так а если number содержит больше чем 6ть цифр?

int number = 0;
cout << "Enter number of ticket ";
cin >> number;
int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;
Copy link
Owner

Choose a reason for hiding this comment

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

имена переменных огонь)

a = number % 10;
b = (number / 10) % 10;
c = (number / 100) % 10;
d = (number / 1000) % 10;
Copy link
Owner

Choose a reason for hiding this comment

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

можно завести одну переменную для левой части суммы и другую переменную для правой части

long long left_side = number % 10;
left_side += (number / 10) % 10;
left_side += (number / 100) % 10;

long long right_side = (number / 1000) % 10;
right_side += (number / 10000) % 10;
right_side += (number / 100000) % 10;

if (a + b + c == e + d + f)
cout << "Yes it's lucky ticket" << endl;
else
cout << "Try your luck again :3" << endl;
Copy link
Owner

Choose a reason for hiding this comment

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

зачем заливать один и тот же код?

if (b3 > average)
count += b3 - average;
cout << count << endl;
}
Copy link
Owner

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

Comments