瀏覽代碼

README-en.md edited online with Bitbucket

Jose R Ortiz Ubarri 8 年之前
父節點
當前提交
f491dfca93
共有 1 個文件被更改,包括 7 次插入7 次删除
  1. 7
    7
      README-en.md

+ 7
- 7
README-en.md 查看文件

41
 
41
 
42
 ---
42
 ---
43
 
43
 
44
-##Functions
44
+## Functions
45
 
45
 
46
 In mathematics, a function $$f$$ is a rule that is used to assign to each element $$x$$ from a set called *domain*, one (and only one) element $$y$$ from a set called *range*. This rule is commonly represented with an equation, $$y=f(x)$$. The variable $$x$$ is the parameter of the function and the variable $$y$$ will contain the result of the function. A function can have more than one parameter, but only one result. For example, a function can have the form $$y=f(x_1,x_2)$$ where there are two parameters, and for each pair $$(a,b)$$ that is used as an argument in the function, and the function will only one value of $$y=f(a,b)$$. The domain of the function tells us the type of value that the parameter should have and the range tells us the value that the returned result will have.
46
 In mathematics, a function $$f$$ is a rule that is used to assign to each element $$x$$ from a set called *domain*, one (and only one) element $$y$$ from a set called *range*. This rule is commonly represented with an equation, $$y=f(x)$$. The variable $$x$$ is the parameter of the function and the variable $$y$$ will contain the result of the function. A function can have more than one parameter, but only one result. For example, a function can have the form $$y=f(x_1,x_2)$$ where there are two parameters, and for each pair $$(a,b)$$ that is used as an argument in the function, and the function will only one value of $$y=f(a,b)$$. The domain of the function tells us the type of value that the parameter should have and the range tells us the value that the returned result will have.
47
 
47
 
48
 Functions in programming languages are similar. A function has a series of instructions that take the assigned values as parameters and performs a certain task. In C++ and other programming languages, functions return only one result, as it happens in mathematics. The only difference is that a *programming* function could possibly not return any value (in this case the function is declared as `void`). If the function returns a value, we use the instruction `return`. As in math, you need to specify the types of values that the function's parameters and result will have; this is done when declaring the function.
48
 Functions in programming languages are similar. A function has a series of instructions that take the assigned values as parameters and performs a certain task. In C++ and other programming languages, functions return only one result, as it happens in mathematics. The only difference is that a *programming* function could possibly not return any value (in this case the function is declared as `void`). If the function returns a value, we use the instruction `return`. As in math, you need to specify the types of values that the function's parameters and result will have; this is done when declaring the function.
49
 
49
 
50
-###Function header
50
+### Function header
51
 
51
 
52
 The first sentence of a function is called the *header* and its structure is as follows:
52
 The first sentence of a function is called the *header* and its structure is as follows:
53
 
53
 
59
 
59
 
60
 would be the header of the function called `example`, which returns an integer value. The function receives as arguments an integer value (and will store a copy in `var1`), a value of type `float` (and will store a copy in `var2`) and the reference to a variable of type `char` that will be stored in the reference variable `var3`. Note that `var3` has a & symbol before the name of the variable. This indicates that `var3` will contain the reference to a character.
60
 would be the header of the function called `example`, which returns an integer value. The function receives as arguments an integer value (and will store a copy in `var1`), a value of type `float` (and will store a copy in `var2`) and the reference to a variable of type `char` that will be stored in the reference variable `var3`. Note that `var3` has a & symbol before the name of the variable. This indicates that `var3` will contain the reference to a character.
61
 
61
 
62
-###Calling
62
+### Calling
63
 
63
 
64
 If we want to store the value of the result of the function called `example` in a variable `result` (that would be of type integer), we call the function by passing arguments as follows:
64
 If we want to store the value of the result of the function called `example` in a variable `result` (that would be of type integer), we call the function by passing arguments as follows:
65
 
65
 
77
 
77
 
78
 
78
 
79
 
79
 
80
-###Overloaded Functions
80
+### Overloaded Functions
81
 
81
 
82
 Overloaded functions are functions that have the same name, but a different *signature*.
82
 Overloaded functions are functions that have the same name, but a different *signature*.
83
 
83
 
123
 
123
 
124
 **Examples of Function Headers and Valid Function Calls:**
124
 **Examples of Function Headers and Valid Function Calls:**
125
 
125
 
126
-1. **Headers:** `int example(int var1, float var2, int var3 = 10)` Here `var3` is initialized to 10.
126
+1. **Header:** `int example(int var1, float var2, int var3 = 10)` Here `var3` is initialized to 10.
127
 
127
 
128
     **Calls:**
128
     **Calls:**
129
 
129
 
214
 
214
 
215
 1. Load the project `DVDInfo` into `QtCreateor`. There are two wayss to do this: 
215
 1. Load the project `DVDInfo` into `QtCreateor`. There are two wayss to do this: 
216
 
216
 
217
-       * Using the virtual machine: Double click the file `DVDInfo.pro` located in the folder `home/eip/labs/functions-dvdinfo` of your virtual machine. 
218
-   	   * Downloading the project's folder from `Bitbucket`: Use a terminal and write the command `git clone http://bitbucket.org/eip-uprrp/functions-dvdinfo` to download the folder `functions-dvdinfo` from `Bitbucket`. Double click the file `DVDInfo.pro` located in the folder that you downloaded to your computer. 
217
+      * Using the virtual machine: Double click the file `DVDInfo.pro` located in the folder `home/eip/labs/functions-dvdinfo` of your virtual machine. 
218
+      * Downloading the project's folder from `Bitbucket`: Use a terminal and write the command `git clone http://bitbucket.org/eip-uprrp/functions-dvdinfo` to download the folder `functions-dvdinfo` from `Bitbucket`. Double click the file `DVDInfo.pro` located in the folder that you downloaded to your computer. 
219
 
219
 
220
 2. Configure the project. The file `main.cpp` has the function calls that you will use in the next exercises. The declarations and definitions of the functions that will be called can be found in the files `movie.h` and `movie.cpp`.
220
 2. Configure the project. The file `main.cpp` has the function calls that you will use in the next exercises. The declarations and definitions of the functions that will be called can be found in the files `movie.h` and `movie.cpp`.
221
 
221