fix: replace languages preceded by space
This commit is contained in:
committed by
Kristofer Koishigawa
parent
2b553d31b6
commit
8ce1b374e3
@@ -60,21 +60,20 @@ Lets write a program which will print numbers from 0 to 1000 including 1000 on t
|
|||||||
` for(int i=0;i<=1000;i++) `
|
` for(int i=0;i<=1000;i++) `
|
||||||
* If there is only one statement inside the loop then the curly bracket is optional but its better to write loop code
|
* If there is only one statement inside the loop then the curly bracket is optional but its better to write loop code
|
||||||
within brackets so that you don't get confused.
|
within brackets so that you don't get confused.
|
||||||
``` c++
|
```cpp
|
||||||
for(int i=0;i<=1000;i++)
|
for(int i=0;i<=1000;i++)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
* Then inside the loop you write what do you want to do. In the above program we output the value of i.
|
* Then inside the loop you write what do you want to do. In the above program we output the value of i.
|
||||||
|
|
||||||
So, in this way the for loop works
|
So, in this way the for loop works
|
||||||
|
|
||||||
If you want to print even numbers from 1 to 1000 then your program will look like this
|
If you want to print even numbers from 1 to 1000 then your program will look like this
|
||||||
``
|
```cpp
|
||||||
|
لـ (int i = 0؛ i = 1000 = i = i + 2) { cout << i << endl؛ }
|
||||||
|
|
||||||
ج ++ لـ (int i = 0؛ i = 1000 = i = i + 2) { cout << i << endl؛ }
|
```
|
||||||
|
|
||||||
\`\` \`
|
|
||||||
|
|
||||||
* الفرق في البرنامج الأول والثاني هو جزء الزيادة. بقية الكود هو نفسه. هذا البرنامج سوف يطبع 0 و ثم إضافة 2 إليه وطباعة 2 على وحدة التحكم وهكذا تصبح قيمة up تساوي 1000.
|
* الفرق في البرنامج الأول والثاني هو جزء الزيادة. بقية الكود هو نفسه. هذا البرنامج سوف يطبع 0 و ثم إضافة 2 إليه وطباعة 2 على وحدة التحكم وهكذا تصبح قيمة up تساوي 1000.
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@ When you execute this code in a c++ program numbers from 1 to 1000 will be print
|
|||||||
` for(int i=0;i<=1000;i++) `
|
` for(int i=0;i<=1000;i++) `
|
||||||
* If there is only one statement inside the loop then the curly bracket is optional but its better to write loop code
|
* If there is only one statement inside the loop then the curly bracket is optional but its better to write loop code
|
||||||
within brackets so that you don't get confused.
|
within brackets so that you don't get confused.
|
||||||
``` c++
|
```cpp
|
||||||
for(int i=0;i<=1000;i++)
|
for(int i=0;i<=1000;i++)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,7 @@ Note that inlining is only a request to the compiler, not a command. The compile
|
|||||||
* When performance is important.
|
* When performance is important.
|
||||||
* Instead of a macro.
|
* Instead of a macro.
|
||||||
|
|
||||||
``` c++
|
```cpp
|
||||||
#include<iostream>
|
#include<iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@@ -16,7 +16,7 @@ There is this concept in mathematics: "each generating function has a sequence a
|
|||||||
In this section we'll show you how to include the standard math library in different languages including a short example of how you can use it.
|
In this section we'll show you how to include the standard math library in different languages including a short example of how you can use it.
|
||||||
|
|
||||||
#### C#
|
#### C#
|
||||||
``` cs
|
```csharp
|
||||||
using System.Math;
|
using System.Math;
|
||||||
|
|
||||||
public class Calculator {
|
public class Calculator {
|
||||||
@@ -41,12 +41,12 @@ Documentation reference: <a href='https://msdn.microsoft.com/en-us/library/syste
|
|||||||
|
|
||||||
#### JavaScript
|
#### JavaScript
|
||||||
With Node.js
|
With Node.js
|
||||||
``` javascript
|
```javascript
|
||||||
var math = require( 'mathjs' );
|
var math = require( 'mathjs' );
|
||||||
```
|
```
|
||||||
|
|
||||||
In the browser
|
In the browser
|
||||||
``` html
|
```html
|
||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@@ -64,14 +64,14 @@ In the browser
|
|||||||
Documentation reference: <a href='http://mathjs.org/docs/index.html' target='_blank' rel='nofollow'>Math.js documentation</a>
|
Documentation reference: <a href='http://mathjs.org/docs/index.html' target='_blank' rel='nofollow'>Math.js documentation</a>
|
||||||
|
|
||||||
#### C++
|
#### C++
|
||||||
``` cpp
|
```cpp
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
```
|
```
|
||||||
|
|
||||||
Documentation reference: <a href='http://www.cplusplus.com/reference/cmath/' target='_blank' rel='nofollow'>cplusplus reference</a>
|
Documentation reference: <a href='http://www.cplusplus.com/reference/cmath/' target='_blank' rel='nofollow'>cplusplus reference</a>
|
||||||
|
|
||||||
#### Python
|
#### Python
|
||||||
``` python
|
```python
|
||||||
>>> import math
|
>>> import math
|
||||||
>>> math.sqrt(9) //takes only positive roots into consideration
|
>>> math.sqrt(9) //takes only positive roots into consideration
|
||||||
3.0
|
3.0
|
||||||
|
@@ -57,7 +57,7 @@ When you execute this code in a c++ program numbers from 1 to 1000 will be print
|
|||||||
` for(int i=0;i<=1000;i++) `
|
` for(int i=0;i<=1000;i++) `
|
||||||
* If there is only one statement inside the loop then the curly bracket is optional but its better to write loop code
|
* If there is only one statement inside the loop then the curly bracket is optional but its better to write loop code
|
||||||
within brackets so that you don't get confused.
|
within brackets so that you don't get confused.
|
||||||
``` c++
|
```cpp
|
||||||
for(int i=0;i<=1000;i++)
|
for(int i=0;i<=1000;i++)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,7 @@ When you execute this code in a c++ program numbers from 1 to 1000 will be print
|
|||||||
` for(int i=0;i<=1000;i++) `
|
` for(int i=0;i<=1000;i++) `
|
||||||
* If there is only one statement inside the loop then the curly bracket is optional but its better to write loop code
|
* If there is only one statement inside the loop then the curly bracket is optional but its better to write loop code
|
||||||
within brackets so that you don't get confused.
|
within brackets so that you don't get confused.
|
||||||
``` c++
|
```cpp
|
||||||
for(int i=0;i<=1000;i++)
|
for(int i=0;i<=1000;i++)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -57,28 +57,28 @@ When you execute this code in a c++ program numbers from 1 to 1000 will be print
|
|||||||
` for(int i=0;i<=1000;i++) `
|
` for(int i=0;i<=1000;i++) `
|
||||||
* If there is only one statement inside the loop then the curly bracket is optional but its better to write loop code
|
* If there is only one statement inside the loop then the curly bracket is optional but its better to write loop code
|
||||||
within brackets so that you don't get confused.
|
within brackets so that you don't get confused.
|
||||||
``` c++
|
```cpp
|
||||||
for(int i=0;i<=1000;i++)
|
for(int i=0;i<=1000;i++)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
* Then inside the loop you write what do you want to do. In the above program we output the value of i.
|
* Then inside the loop you write what do you want to do. In the above program we output the value of i.
|
||||||
|
|
||||||
So, in this way the for loop works
|
So, in this way the for loop works
|
||||||
|
|
||||||
If you want to print even numbers from 1 to 1000 then your program will look like this
|
If you want to print even numbers from 1 to 1000 then your program will look like this
|
||||||
|
```cpp
|
||||||
|
|
||||||
|
para (int i = 0; i <= 1000; i = i + 2) { cout << i << endl; }
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
c ++ para (int i = 0; i <= 1000; i = i + 2) { cout << i << endl; }
|
|
||||||
|
|
||||||
\`\` \`
|
|
||||||
|
|
||||||
* La diferencia entre el primer programa y el segundo es la parte de incremento. El resto del código es el mismo. Este programa imprimirá 0 y luego agregue 2 e imprima 2 en la consola y así sucesivamente hasta que el valor de i sea igual a 1000.
|
* La diferencia entre el primer programa y el segundo es la parte de incremento. El resto del código es el mismo. Este programa imprimirá 0 y luego agregue 2 e imprima 2 en la consola y así sucesivamente hasta que el valor de i sea igual a 1000.
|
||||||
|
|
||||||
Nuestro programa final para imprimir números pares de 0 a 1000 se verá así.
|
Nuestro programa final para imprimir números pares de 0 a 1000 se verá así.
|
||||||
|
|
||||||
\`\` \`c ++
|
```cpp
|
||||||
|
|
||||||
# incluir
|
# incluir
|
||||||
|
utilizando namespace std; int main () { para (int i = 0; i <= 1000; i = i + 2) { cout << i << endl; } devuelve 0; }
|
||||||
utilizando namespace std; int main () { para (int i = 0; i <= 1000; i = i + 2) { cout << i << endl; } devuelve 0; } \`\` \`
|
```
|
||||||
|
Reference in New Issue
Block a user