These first examples also reveal a few differences between PAWN and the C lan guage: ⋄…
- User
These first examples also reveal a few differences between PAWN and the C lan guage: ⋄ there is usually no need to include any system-defined “header file”; ⋄ youmayuse“main”inPAWNasanalternative to @start; ⋄ semicolons are optional (except when writing multiple statements on one line); ⋄ whenthe body of a function is a single instruction, the braces (for a compound instruction) are optional; ⋄ when you do not use the result of a function in an expression or assignment, parentheses around the function argument are optional. As an aside, the few preceding points refer to optional syntaxes. It is your choice what syntax you wish to use: neither style is “deprecated” or “preferred”. The ex amples in this manual position the braces and use an indentation format that is known as the “Whitesmithʼs style”, but PAWN is a free format language and other indenting styles are just as fine. More function de scriptions at page 106 BecausePAWNisdesignedtobeanextensionlanguage forapplications, the function set/library that a PAWN program has at its disposal depends on the host applica tion. As a result, the PAWN language has no intrinsic knowledge of any function. Theprintfunction, used in this first example, must be made available by the host application and be “declared” to the PAWN parser. It is assumed, however, that all host applications provide a minimal set of common functions, like print and printf. Insomeenvironments,thedisplayorterminalmustbeenabledbeforeanytextcan be output onto it. If this is the case, you must add a call to the function “console” before the first call to function print or printf. The console function also allows you to specify device characteristics, such as the number of lines and columns of the display. The example programs in this manual do not use the console func tions, because many platforms do not require or provide it
поправь форматирование и переведи на русский язык.
- Assistant
Конечно, вот исправленное форматирование и перевод на русский язык:
Эти первые примеры также выявляют несколько отличий между PAWN и языком C:
- Обычно нет необходимости включать какие-либо системно определенные «заголовочные файлы»;
- Вы можете использовать «main» в PAWN как альтернативу @start;
- Точки с запятой являются необязательными (за исключением случаев, когда вы пишете несколько операторов в одной строке);
- Если тело функции состоит из одного оператора, фигурные скобки (для составного выражения) являются необязательными;
- User
и ето "Loop instructions, like “while”, repeat a single statement as long as the loop con- “while” loop: 99 “if–else”: 97 dition (the expression that follows the while keyword) is “true”. One can execute multiple statements in a loop by grouping them in a compound statement. The if–else instruction has one statement for the “true” clause and one for the “false”. Observe that some statements, like while and if–else, contain (or “fold around”) another instruction —in the case of if–else even two other instructions. The com- plete bundle is, again, a single instruction. That is: ⋄ the assignment statements “a = a - b” below the if and “b = b - a” below the else are statements; ⋄ the if–else statement folds around these two assignments and forms a single statement of itself; ⋄ the while statement folds around the if–else statement and thus forms, again, a single statement. It is common to make the nesting of the statements explicit by indenting any sub- statements below a statement in the source text. In the “Greatest Common Divisor” example, the left margin indent increases by four space characters after the while statement, and again after the if and else keywords. Statements that belong to the same level, such as both printf invocations and the while loop, have the same indentation. The loop condition for the while loop is “(a != b)”; the symbol != is the “not Relational opera- tors: 92 equal to” operator. That is, the if–else instruction is repeated until “a” equals “b”. It is good practice to indent the instructions that run under control of another statement, as is done in the preceding example. The call to printf, near the bottom of the example, differs from the print call right below the opening brace (“{”). The “f” in printf stands for “formatted”, which means that the function can format and print numeric values and other data (in a user-specified format), as well as literal text. The %d symbol in the string is a token that indicates the position and the format that the subsequent argument to function printf should be printed. At run time, the token %d is replaced by the value of variable “a” (the second argument of printf). Function print can only print text; it is quicker than printf. If you want to print a literal “%” at the display, you have to use print, or you have to double it in the string that you give to printf. That is: andprint "20% of the personnel accounts for 80% of the costs\n" printf "20%% of the personnel accounts for 80%% of the costs\n" print the same string."
- Assistant
Вот исправленное форматирование и перевод текста на русский язык:
- User
такие слова как printf if else должны быть заключены в
text - Assistant
- User
The Fibonacci numbers sequence describes a surprising variety of natural phe- nomena. For example, the two or three sets of spirals in pineapples, pine cones and sunflowers usually have consecutive Fibonacci numbers between 5 and 89 as their number of spirals. The numbers that occur naturally in branching patterns (e.g. that of plants) are indeed Fibonacci numbers. Finally, although the Fibonacci sequence is not a geometric sequence, the further the sequence is extended, the more closely the ratio between successive terms approaches the Golden Ratio, of 1.618 that appears so often in art and architecture.∗
- Assistant
Вот исправленный текст с выделением специальных терминов и форматированием:
Последовательность Фибоначчи описывает удивительное разнообразие природных явлений. Например, две или три группы спиралей в ананасах, шишках и подсолнухах обычно имеют последовательные числа Фибоначчи между 5 и 89 как количество своих спиралей. Числа, которые встречаются в естественных разветвленных узорах (например, у растений), действительно являются числами Фибоначчи. Наконец, хотя последовательность Фибоначчи не является геометрической прогрессией, чем дальше расширяется последовательность, тем ближе отношение между последовательными членами приближается к Золотому сечению, равному 1,618, которое так часто встречается в искусстве и архитектуре.
Если вам нужно что-то еще или дополнительные изменения, пожалуйста, дайте знать!
- User
Dates are a particularly rich source of algorithms and conversion routines, because the calenders that a date refers to have known such a diversity, through time and around the world. The “Julian Day Number” is attributed to Josephus Scaliger† and it counts the num- ber of days since November 24, 4714 BC (proleptic Gregorian calendar‡). Scaliger chose that date because it marked the coincidence of three well-established cycles: the 28-year Solar Cycle (of the old Julian calendar), the 19-year Metonic Cycle and the 15-year Indiction Cycle (periodic taxes or governmental requisitions in ancient Rome), and because no literature or recorded history was known to pre-date that particular date in the remote past. Scaliger used this concept to reconcile dates in historic documents, later astronomers embraced it to calculate intervals between two events more easily. Julian Day numbers (sometimes denoted with unit “JD”) should not be confused with Julian Dates (the number of days since the start of the same year), or with the Julian calendar that was introduced by Julius Caesar.
- Assistant
Вот исправленный текст с выделением ключевых терминов и форматированием:
Даты являются особенно богатым источником алгоритмов и процедур преобразования, поскольку календари, к которым относится дата, имеют известное разнообразие на протяжении времени и по всему миру.
«Юлианский день» относится к Йосифу Скалигеру† и считает количество дней с 24 ноября 4714 года до нашей эры (пролептический григорианский календарь‡). Скалигер выбрал эту дату, потому что она отмечала совпадение трех хорошо установленных циклов: 28-летнего солнечного цикла (старого юлианского календаря), 19-летнего метоновского цикла и 15-летнего индикационного цикла (периодические налоги или государственные реквизиты в Древнем Риме), и потому что никакая литература или записанная история не была известна до этой конкретной даты в далеком прошлом. Скалигер использовал эту концепцию для согласования дат в исторических документах, а позднее астрономы использовали ее, чтобы легче вычислять промежутки времени между двумя событиями.
Юлианские дни (иногда обозначаемые единицей «JD») не следует путать с юлианскими датами (количеством дней с начала того же года) или с юлианским календарем, который был введен Юлием Цезарем.
- User
Below is a program that calculates the Julian Day number from a date in the (pro- leptic) Gregorian calendar, and vice versa. Note that in the proleptic Gregorian calendar, the first year is 1 AD (Anno Domini) and the year before that is 1 BC (Be- fore Christ): year zero does not exist! The program uses negative year values for BC years and positive (non-zero) values for AD years.
- Assistant
Вот исправленный текст с выделением ключевых терминов и форматированием:
Ниже представлен программа, которая вычисляет Юлианский день из даты в (пролептическом) григорианском календаре и наоборот. Обратите внимание, что в пролептическом григорианском календаре первый год – это 1 год н. э. (Anno Domini), а год перед ним – это 1 год до н. э. (Before Christ): года ноль не существует! Программа использует отрицательные значения годов для годов до н. э. и положительные (ненулевые) значения для годов н. э.
Если вам потребуется дополнительная информация или изменения, дайте знать!
- User
- Assistant