Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
(an example is provided in the Appword_endix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
Expand Down Expand Up @@ -116,7 +116,7 @@
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
or as an addword_endum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

Expand Down Expand Up @@ -169,19 +169,19 @@
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
defword_end, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS
WORD_END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.
APPWORD_ENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
comment syntax for the file format. We also recommword_end that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Expand Down
35 changes: 34 additions & 1 deletion homework_01/task_01/src/utils.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@
#include "utils.hpp"

#include <iostream>
#include <stack>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  1. Хидеры стандартной библиотеки включаются с использованием угловых скобок
  2. Одноимённый хидер (в данном случае это utils.hpp) следует отделять от остальных хидеров пустой строкой
#include "utils.hpp"

#include <iostream>
#include <stack>


std::vector<std::string> SplitString(const std::string& data) {
return {};
std::vector<std::string> out;
size_t word_start;
size_t word_end = 0;
bool in_brackets = false;
size_t opening_bracket = 0;

while ((word_start = data.find_first_not_of(' ', word_end)) != std::string::npos)
{
if (data[word_end]==')'){
in_brackets = false;
word_end += 1;
out.push_back(data.substr(opening_bracket, word_end - opening_bracket));
continue;
}
if (in_brackets == 1){
word_end += 1;
continue;
}
if (data[word_start]=='('){
opening_bracket = word_start;
in_brackets = 1;
continue;
}
if (data[word_start]=='\t'){
word_start += 1;
}
word_end = data.find(' ', word_start);
if (data.find('\t', word_start) < data.find(' ', word_start)){
word_end = data.find('\t', word_start);
}
out.push_back(data.substr(word_start, word_end - word_start));
}
return out;
}
22 changes: 20 additions & 2 deletions homework_01/task_02/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,23 @@
#include <stack>

int Calculate(const std::string& data) {
return 0;
}
int a, b, result;
result = 0;
a = data[0]-'0';
b = data[2] - '0';
switch (data[1]){
case ('+'):
result = a + b;
return result;
case ('-'):
result = a - b;
return result;
case ('*'):
result = a * b;
return result;
case ('/'):
result = a / b;
return result;
}
return 0;
}