Skip to content

push homework 5#7

Merged
nedav347 merged 1 commit intomainfrom
lesson_5
Mar 13, 2021
Merged

push homework 5#7
nedav347 merged 1 commit intomainfrom
lesson_5

Conversation

@nedav347
Copy link
Copy Markdown
Owner

  • Домашнее задание к уроку 5
  • курса "Основы языка С++"
  • автор Недокунев А.В.
  • среда разработки Notepad++ /компилятор MinGW/
  • codepage UTF-8
  • lesson5.cpp - задания с 1 по 5**
  • lesson56.cpp, lesson5_checkBalance.cpp, lesson5_convert.cpp, lesson5_convert_v.cpp, lesson5_fill.cpp, lesson5_shiftarr.cpp - задание 6**.


void convert(int* arr, int s){//для 1 задания
for (size_t i=0; i < s; i++){
arr[i] = 1 - arr[i];//у нас только 0 и 1 - зачем тут "if-else, switch, () ? :)"? :)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

именно! но подавляющее большинство идут именно путём условий)

int val = 1;
for (size_t i=0; i < s; i++){
arr[i] = val;//это ж не Фибоначчи... :)
val += 3;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

можно обойтись без вспомогательной переменной

void fill(int* arr, int s){//для 2 задания
int val = 1;
for (size_t i=0; i < s; i++){
arr[i] = val;//это ж не Фибоначчи... :)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

нет, это на смекалку, см следующий коммент)

@nedav347 nedav347 merged commit a8a5913 into main Mar 13, 2021
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