{"id":285566,"date":"2017-04-26T16:40:32","date_gmt":"2017-04-26T12:40:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=285566"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=285566","title":{"rendered":"\u0410\u0432\u0442\u043e\u043d\u043e\u043c\u0435\u0440 \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u044f\u0437\u044b\u043a\u0430\u0445. \u0427\u0430\u0441\u0442\u044c 1"},"content":{"rendered":"<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"https:\/\/habrastorage.org\/files\/5e7\/678\/00f\/5e767800f809427e896af2d878ab26c0.png\"\/><\/div>\n<p>  <\/p>\n<h1>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0432\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435.<\/h1>\n<p>  <\/p>\n<p>\u042f \u043f\u043e\u043f\u0430\u043b \u0432 \u043c\u0438\u0440 IT \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u043e: \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u0433\u043e\u0434\u0430 \u044f \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u043e\u0434 iOS. \u041d\u043e \u043a\u0440\u043e\u043c\u0435 Objective-C \u0438 Swift \u043c\u0435\u043d\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u0430\u043d\u0438\u043b \u043c\u0438\u0440 Java \u0438 C#. \u041f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u044f \u0432\u044b\u0434\u0435\u043b\u044f\u043b \u0432\u0440\u0435\u043c\u044f, \u0447\u0442\u043e\u0431 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0432\u0438\u0434\u0435\u043e, \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0435 \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u044d\u0442\u0438\u0445 \u044f\u0437\u044b\u043a\u043e\u0432, \u043d\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0441 \u044d\u043a\u0440\u0430\u043d\u0430 \u0434\u0435\u043b\u043e \u043d\u0435 \u0437\u0430\u0445\u043e\u0434\u0438\u043b\u043e. \u0418 \u0442\u0443\u0442 \u044f \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043b \u043e\u0431 \u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438\u0433\u0440\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043d\u0435 \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u043f\u043e\u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u043b \u043c\u043e\u0439 \u0434\u0440\u0443\u0433.<\/p>\n<p>  <\/p>\n<p>\u0421\u0443\u0442\u044c \u0438\u0433\u0440\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c: \u0432\u044b \u0438\u0434\u0435\u0442\u0435 \u043f\u043e \u0443\u043b\u0438\u0446\u0435 \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u043d\u043e\u043c\u0435\u0440\u0430. \u0418 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043d\u043e\u043c\u0435\u0440\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0435 \u0441\u0443\u043c\u043c\u0443 \u0432\u0441\u0435\u0445 \u0446\u0438\u0444\u0440 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043d\u043e\u043c\u0435\u0440\u0435 8037 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c 8 + 0 + 3 + 7). \u042d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438\u0433\u0440\u044b. \u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u2014 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u0443 \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u044b \u043d\u043e\u043c\u0435\u0440\u0430 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 (80 + 37). \u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u0442\u0440\u0435\u0442\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u2014 \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u0432\u0441\u0435 \u0446\u0438\u0444\u0440\u044b (\u043d\u0443\u043b\u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0432: 8 \u0445 3 \u0445 7) \u0438 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u0439 \u2014 \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u0443\u044e \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u043d\u043e\u043c\u0435\u0440\u0430 \u043d\u0430 \u0432\u0442\u043e\u0440\u0443\u044e (80 \u0445 37).<\/p>\n<p>  <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c: \u044d\u0442\u0443 \u0438\u0433\u0440\u0443 (\u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435) \u044f \u0438 \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u044f\u0437\u044b\u043a\u0430\u0445: Swift, Objective-C, Java \u0438 C#. \u0427\u0442\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c.<\/p>\n<p>  <\/p>\n<p><a name=\"habracut\"><\/a><\/p>\n<h1>\u0421 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u043d\u0435\u043c?<\/h1>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u043c\u044b \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0443\u0441\u0442\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043f\u043e\u0434 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f: \u0434\u043b\u044f Swift \u0438 Objective-C \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Xcode, \u0434\u043b\u044f Java \u2014 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e IntelliJ IDEA, \u0430 \u0434\u043b\u044f C# \u2014 Xamarin Studio.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>GameStart<\/code>. \u041e\u043d \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e\u043a\u0430 \u0442\u043e\u0442 \u043d\u0435 \u0432\u0432\u0435\u0434\u0435\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u0434\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<h3><i>Swift<\/i><\/h3>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0430\u043c \u043a\u043b\u0430\u0441\u0441:<\/p>\n<p>  <\/p>\n<pre><code>class GameStart {  }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043d\u0435\u043c \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>exitWord<\/code> \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440:<\/p>\n<p>  <\/p>\n<pre><code>private var exitWord: String  init(with exitWord: String) {     self.exitWord = exitWord }<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0448\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 \u043d\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 <code>startGame<\/code> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e\u0442\u0432\u0435\u0442, \u043f\u043e\u043a\u0430 \u0442\u043e\u0442 \u043d\u0435 \u0432\u0432\u0435\u0434\u0435\u0442 \u0441\u043b\u043e\u0432\u043e \u0434\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code>func startGame() {     print(GreetingMessage.replacingOccurrences(of: ExitWordPlaceholder, with: self.exitWord))     guard let inputWord = readLine() else {         print(ErrorMessage)         return     }      self.check(inputWord: inputWord) }  private func check(inputWord: String) {     if inputWord == self.exitWord {         print(GoodByeMessage)     } else {         print(InputAcceptMessage.replacingOccurrences(of: InputWordPlaceholder, with: inputWord))         startGame()     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043c\u0435\u0442\u043e\u0434 <code>startGame<\/code> \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0437\u0430\u0442\u0435\u043c \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0442\u043e \u0447\u0442\u043e \u0432\u0432\u0435\u043b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043c\u0435\u0442\u043e\u0434 <code>check(inputWord:)<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0421\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b:<\/p>\n<p>  <\/p>\n<pre><code>private let ExitWordPlaceholder = &quot;{exitWord}&quot; private let InputWordPlaceholder = &quot;{inputWord}&quot;  private let GreetingMessage = &quot;Please enter your answer (enter \\&quot;\\(ExitWordPlaceholder)\\&quot; for exit):&quot; private let InputAcceptMessage = &quot;You entered \\&quot;\\(InputWordPlaceholder)\\&quot;.\\n&quot; private let GoodByeMessage = &quot;Good bye.\\n&quot; private let ErrorMessage = &quot;There is unknown error, sorry. Good bye.\\n&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441 \u0433\u043e\u0442\u043e\u0432, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>startGame()<\/code>:<\/p>\n<p>  <\/p>\n<pre><code>let gameStart = GameStart(with: &quot;quit&quot;) gameStart.startGame()<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"https:\/\/habrastorage.org\/files\/eb7\/03d\/b20\/eb703db2087146e0953f809a0cbe4a5e.png\"\/><\/div>\n<p>  <\/p>\n<h3><i>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u044d\u0442\u043e\u0442 \u0436\u0435 \u043a\u043b\u0430\u0441\u0441 \u043d\u0430 Objective-C:<\/i><\/h3>\n<p>  <\/p>\n<pre><code>\/\/ \u0444\u0430\u0439\u043b \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 GameStart.h @interface GameStart : NSObject  - (instancetype)initWithExitWord:(NSString *)exitWord; - (void)startGame;  @end  \/\/ \u0444\u0430\u0439\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 GameStart.m const NSString *GreetingMessage = @&quot;Please enter your answer (enter \\&quot;%@\\&quot; for exit):&quot;; const NSString *InputAcceptMessage = @&quot;You entered \\&quot;%@\\&quot;.\\n&quot;; const NSString *GoodByeMessage = @&quot;Good bye.\\n&quot;; const NSString *ErrorMessage = @&quot;There is unknown error, sorry. Good bye.\\n&quot;;  @interface GameStart()  @property (strong, nonatomic) NSString *exitWord;  @end  @implementation GameStart  - (instancetype)initWithExitWord:(NSString *)exitWord {     self = [super init];     if (self) {         self.exitWord = exitWord;     }     return self; }  - (void)startGame {     NSLog(GreetingMessage, self.exitWord);     NSString *inputWord = [self readLine];      if (inputWord) {         [self checkInputWord:inputWord];     } else {         NSLog(@&quot;%@&quot;, ErrorMessage);     } }  - (void)checkInputWord:(NSString *)inputWord {     if ([inputWord isEqualToString:self.exitWord]) {         NSLog(@&quot;%@&quot;, GoodByeMessage);     } else {         NSLog(InputAcceptMessage, inputWord);         [self startGame];     } }  - (NSString *)readLine {     char inputValue;     scanf(&quot;%s&quot;, &amp;inputValue);     return [NSString stringWithUTF8String:&amp;inputValue]; }  @end<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0443 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code>GameStart *gameStart = [[GameStart alloc] initWithExitWord:@&quot;quit&quot;]; [gameStart startGame];<\/code><\/pre>\n<p>  <\/p>\n<h3><i>\u0414\u0430\u043b\u044c\u0448\u0435 \u0443 \u043d\u0430\u0441 \u043d\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 Java.<\/i><\/h3>\n<p>  <\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 <code>GameStart<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">public class GameStart {      private static final String GreetingMessage = &quot;Please enter your answer (enter \\&quot;%s\\&quot; for exit):&quot;;     private static final String InputAcceptMessage = &quot;You entered \\&quot;%s\\&quot;.\\n&quot;;     private static final String GoodByeMessage = &quot;Good bye.\\n&quot;;      private String exitWord;      public GameStart(String exitWord) {         this.exitWord = exitWord;     }      void startGame() {         System.out.println(String.format(GreetingMessage, exitWord));         String inputWord = readLine();          checkInputWord(inputWord);     }      private void checkInputWord(String inputWord) {         if (inputWord.equals(exitWord)) {             System.out.println(GoodByeMessage);         } else {             System.out.println(String.format(InputAcceptMessage, inputWord));             startGame();         }     }      private String readLine() {         java.util.Scanner scanner = new java.util.Scanner(System.in);         return scanner.next();     }  }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0432\u044b\u0437\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">GameStart gameStart = new GameStart(&quot;quit&quot;); gameStart.startGame();<\/code><\/pre>\n<p>  <\/p>\n<h3><i>\u0418 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0447\u0435\u0442\u0432\u0435\u0440\u043a\u0443 \u043b\u0438\u0434\u0435\u0440\u043e\u0432 C#.<\/i><\/h3>\n<p>  <\/p>\n<p>\u041a\u043b\u0430\u0441\u0441:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public class GameStart {     const string GreetingMessage = &quot;Please enter your answer (enter \\&quot;{0}\\&quot; for exit):&quot;;     const string InputAcceptMessage = &quot;You entered \\&quot;{0}\\&quot;.\\n&quot;;     const string GoodByeMessage = &quot;Good bye.\\n&quot;;      readonly string exitWord;      public GameStart(string exitWord)     {         this.exitWord = exitWord;     }      public void startGame()     {         Console.WriteLine(string.Format(GreetingMessage, exitWord));         string inputWord = Console.ReadLine();          checkInputWord(inputWord);     }      void checkInputWord(string inputWord)     {         if (inputWord.Equals(exitWord))         {             Console.WriteLine(GoodByeMessage);         }         else         {             Console.WriteLine(string.Format(InputAcceptMessage, inputWord));             startGame();         }     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u044b\u0437\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">GameStart gameStart = new GameStart(&quot;quit&quot;); gameStart.startGame();<\/code><\/pre>\n<p>  <\/p>\n<h1>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0434\u043e\u043c\u0430 \u043d\u0435 \u043f\u043e\u0432\u0440\u0435\u0434\u0438\u0442.<\/h1>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 (\u043d\u043e\u043c\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0446\u0438\u0444\u0440). \u0421\u0430\u043c \u043a\u043b\u0430\u0441\u0441 \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u2014 <code>Randomizer<\/code>.<\/p>\n<p>  <\/p>\n<h3><i>Swift:<\/i><\/h3>\n<p>  <\/p>\n<pre><code>class Randomizer {      var firstNumber: UInt32     var secondNumber: UInt32     var thirdNumber: UInt32     var fourthNumber: UInt32      init() {         self.firstNumber = arc4random() % 10         self.secondNumber = arc4random() % 10         self.thirdNumber = arc4random() % 10         self.fourthNumber = arc4random() % 10     } }<\/code><\/pre>\n<p>  <\/p>\n<h3><i>Objective-C:<\/i><\/h3>\n<p>  <\/p>\n<pre><code>\/\/ \u0444\u0430\u0439\u043b \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 Randomizer.h @interface Randomizer : NSObject  @property (assign, nonatomic) NSInteger firstNumber; @property (assign, nonatomic) NSInteger secondNumber; @property (assign, nonatomic) NSInteger thirdNumber; @property (assign, nonatomic) NSInteger fourthNumber;  @end  \/\/ \u0444\u0430\u0439\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Randomizer.m @implementation Randomizer  - (instancetype)init {     self = [super init];     if (self) {         self.firstNumber = arc4random() % 10;         self.secondNumber = arc4random() % 10;         self.thirdNumber = arc4random() % 10;         self.fourthNumber = arc4random() % 10;     }     return self; }  @end<\/code><\/pre>\n<p>  <\/p>\n<h3><i>Java:<\/i><\/h3>\n<p>  <\/p>\n<pre><code class=\"java\">public class Randomizer {      private static Random random = new Random();      int firstNumber;     int secondNumber;     int thirdNumber;     int fourthNumber;      public Randomizer() {         firstNumber = random.nextInt(10);         secondNumber = random.nextInt(10);         thirdNumber = random.nextInt(10);         fourthNumber = random.nextInt(10);     }  }<\/code><\/pre>\n<p>  <\/p>\n<h3><i>C#:<\/i><\/h3>\n<p>  <\/p>\n<pre><code class=\"cs\">public class Randomizer {     static readonly Random random = new Random();      public int firstNumber;     public int secondNumber;     public int thirdNumber;     public int fourthNumber;      public Randomizer()     {         firstNumber = random.Next(10);         secondNumber = random.Next(10);         thirdNumber = random.Next(10);         fourthNumber = random.Next(10);     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u043e\u043b\u044f \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u0446\u0435\u043b\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u043e\u0442 0 \u0434\u043e 9.<\/p>\n<p>  <\/p>\n<h1>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0448\u0435 \u0432\u0441\u0435.<\/h1>\n<p>  <\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u0430 \u0438\u0433\u0440\u0430, \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0438\u0434, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 (\u0434\u043b\u044f <code>Swift<\/code> \u0438 <code>Objective-C<\/code> \u2014 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b) <code>Game<\/code> \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 <code>greet(with exitWord: String)<\/code> \u0438 <code>check(userAnswer: String)<\/code>.<\/p>\n<p>  <\/p>\n<h3><i>Swift:<\/i><\/h3>\n<p>  <\/p>\n<pre><code>protocol Game {      func greet(with exitWord: String)     func check(userAnswer: String)  }<\/code><\/pre>\n<p>  <\/p>\n<h3><i>Objective-C:<\/i><\/h3>\n<p>  <\/p>\n<pre><code>@protocol Game &lt;NSObject&gt;  - (void)greetWithExitWord:(NSString *)exitWord; - (void)checkUserAnswer:(NSString *)userAnswer;  @end<\/code><\/pre>\n<p>  <\/p>\n<h3><i>Java:<\/i><\/h3>\n<p>  <\/p>\n<pre><code class=\"java\">public interface Game {      void greet(String exitWord);     void checkUserAnswer(String userAnswer);  }<\/code><\/pre>\n<p>  <\/p>\n<h3><i>C#:<\/i><\/h3>\n<p>  <\/p>\n<pre><code class=\"cs\">public interface IGame {     void greet(string exitWord);     void checkUserAnswer(string userAnswer); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u044f \u0437\u0430\u043a\u043e\u043d\u0447\u0443. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0430\u043c\u043e\u0439 \u0438\u0433\u0440\u044b \u0441 \u0432\u044b\u0431\u043e\u0440\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0430 \u0438\u0433\u0440\u043e\u043a\u0430 \u043d\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c, <s>\u0441 \u0431\u043b\u044d\u043a\u0434\u0436\u0435\u043a\u043e\u043c \u0438 &#8230;<\/s> \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438. \u0412\u0441\u0435\u043c \u0434\u043e\u0431\u0440\u0430. \ud83d\ude42<\/p>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/326568\/\"> https:\/\/habrahabr.ru\/post\/326568\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"https:\/\/habrastorage.org\/files\/5e7\/678\/00f\/5e767800f809427e896af2d878ab26c0.png\"\/><\/div>\n<p>  <\/p>\n<h1>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0432\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435.<\/h1>\n<p>  <\/p>\n<p>\u042f \u043f\u043e\u043f\u0430\u043b \u0432 \u043c\u0438\u0440 IT \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u043e: \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u0433\u043e\u0434\u0430 \u044f \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u043e\u0434 iOS. \u041d\u043e \u043a\u0440\u043e\u043c\u0435 Objective-C \u0438 Swift \u043c\u0435\u043d\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u0430\u043d\u0438\u043b \u043c\u0438\u0440 Java \u0438 C#. \u041f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u044f \u0432\u044b\u0434\u0435\u043b\u044f\u043b \u0432\u0440\u0435\u043c\u044f, \u0447\u0442\u043e\u0431 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0432\u0438\u0434\u0435\u043e, \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0435 \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u044d\u0442\u0438\u0445 \u044f\u0437\u044b\u043a\u043e\u0432, \u043d\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0441 \u044d\u043a\u0440\u0430\u043d\u0430 \u0434\u0435\u043b\u043e \u043d\u0435 \u0437\u0430\u0445\u043e\u0434\u0438\u043b\u043e. \u0418 \u0442\u0443\u0442 \u044f \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043b \u043e\u0431 \u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438\u0433\u0440\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043d\u0435 \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u043f\u043e\u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u043b \u043c\u043e\u0439 \u0434\u0440\u0443\u0433.<\/p>\n<p>  <\/p>\n<p>\u0421\u0443\u0442\u044c \u0438\u0433\u0440\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c: \u0432\u044b \u0438\u0434\u0435\u0442\u0435 \u043f\u043e \u0443\u043b\u0438\u0446\u0435 \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u043d\u043e\u043c\u0435\u0440\u0430. \u0418 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043d\u043e\u043c\u0435\u0440\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0435 \u0441\u0443\u043c\u043c\u0443 \u0432\u0441\u0435\u0445 \u0446\u0438\u0444\u0440 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043d\u043e\u043c\u0435\u0440\u0435 8037 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c 8 + 0 + 3 + 7). \u042d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438\u0433\u0440\u044b. \u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u2014 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u0443 \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u044b \u043d\u043e\u043c\u0435\u0440\u0430 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 (80 + 37). \u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u0442\u0440\u0435\u0442\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u2014 \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u0432\u0441\u0435 \u0446\u0438\u0444\u0440\u044b (\u043d\u0443\u043b\u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0432: 8 \u0445 3 \u0445 7) \u0438 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u0439 \u2014 \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u0443\u044e \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u043d\u043e\u043c\u0435\u0440\u0430 \u043d\u0430 \u0432\u0442\u043e\u0440\u0443\u044e (80 \u0445 37).<\/p>\n<p>  <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c: \u044d\u0442\u0443 \u0438\u0433\u0440\u0443 (\u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435) \u044f \u0438 \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u044f\u0437\u044b\u043a\u0430\u0445: Swift, Objective-C, Java \u0438 C#. \u0427\u0442\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c.<\/p>\n<p>  <\/p>\n<p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-285566","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/285566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=285566"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/285566\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=285566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=285566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=285566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}