|
|
|
|
4
|
![main2.png](images/main2.png)
|
4
|
![main2.png](images/main2.png)
|
5
|
![main3.png](images/main3.png)
|
5
|
![main3.png](images/main3.png)
|
6
|
|
6
|
|
7
|
-[Verano 2016 - Ive - Rafa - Ive- Tatiana]
|
|
|
|
|
7
|
+
|
8
|
|
8
|
|
9
|
Arrays help us to store and work with groups of data of the same type. The data is stored in consecutive memory spaces which can be accessed by using the name of the array and indexes or subscripts that indicate the position where the data is stored. Repetition structures provide us a simple way of accessing the data within an array. In today's laboratory experience, you will practice the use of counters and one dimensional arrays to implement a program in which you will use Benford’s Law to detect files with bogus data.
|
9
|
Arrays help us to store and work with groups of data of the same type. The data is stored in consecutive memory spaces which can be accessed by using the name of the array and indexes or subscripts that indicate the position where the data is stored. Repetition structures provide us a simple way of accessing the data within an array. In today's laboratory experience, you will practice the use of counters and one dimensional arrays to implement a program in which you will use Benford’s Law to detect files with bogus data.
|
10
|
|
10
|
|
|
|
|
|
42
|
|
42
|
|
43
|
|
43
|
|
44
|
|
44
|
|
45
|
-As part of your new job as IT auditor you suspect that someone in the Chicago Transit Authority (CTA) has been tampering with the information systems and changing the data files that contain the bus route daily totals. You are given five text files that contain daily totals for each of the CTA’s bus routes and you must determine if one or more of the files contain bogus data. In this laboratory experience, you will implement a program that will help you determine which of the file(s) contain bogus data using Benford's Law, a property that is observed in many real-life sources of data.
|
|
|
|
|
45
|
+As part of your new job as IT auditor you suspect that someone in the Chicago Transit Authority (CTA) has been tampering with the information systems and changing the data files that contain the bus route's daily totals. You are given five text files that contain daily totals for each of the CTA’s bus routes and you must determine if one or more of the files contain bogus data. In this laboratory experience, you will implement a program that will help you determine which of the file(s) contain bogus data using Benford's Law, a property that is observed in many real-life sources of data.
|
46
|
|
46
|
|
47
|
---
|
47
|
---
|
48
|
|
48
|
|
|
|
|
|
103
|
|
103
|
|
104
|
### Frequency of Occurrence
|
104
|
### Frequency of Occurrence
|
105
|
|
105
|
|
106
|
-The **frequency of occurrence** is defined as the ratio of times that a digit appears divided by the total number of data. For example, the frequency of leading digit `1` in the example would computed as $$9 / 20 = 0.45$$. **Histograms** are the preferred visualization of frequency distributions in a data set. In essence, a histogram is a bar chart where the $$y$$-axis is the frequency and a vertical bar is drawn for each of the counted classifications (in our case, for each digit).
|
|
|
|
|
106
|
+The **frequency of occurrence** is defined as the ratio of times that a digit appears divided by the total number of data. For example, the frequency of leading digit `1` in the example would be computed as $$9 / 20 = 0.45$$. **Histograms** are the preferred visualization of frequency distributions in a data set. In essence, a histogram is a bar chart where the $$y$$-axis is the frequency and a vertical bar is drawn for each of the counted classifications (in our case, for each digit).
|
107
|
|
107
|
|
108
|
---
|
108
|
---
|
109
|
|
109
|
|
|
|
|
|
135
|
|
135
|
|
136
|
## Reading Data From Text Files in C++
|
136
|
## Reading Data From Text Files in C++
|
137
|
|
137
|
|
138
|
-This laboratory experience requires you to read data from a text file. You can skip the next section if you feel that your file reading skills are competent. Otherwise, read on...
|
|
|
|
|
138
|
+This laboratory experience requires you to read data from a text file. You can skip to the next section if you feel that your file reading skills are competent. Otherwise, read on...
|
139
|
|
139
|
|
140
|
|
140
|
|
141
|
-C++ provides functions to read and write data to/from files. In this laboratory experience, you will be using one of the most rudimentary file input/output schemes provided in C++ to read/write from **text** files. Text files consist exclusively of ASCII characters which represent data in any of the primitive types provided by C++. Typically, the values are separated by spaces. For instance, let's assume that the file `nameAge.txt` contains some data about names and ages.
|
|
|
|
|
141
|
+C++ provides functions to read and write data to/from files. In this laboratory experience, you will be using one of the most rudimentary file input/output schemes provided in C++ to read/write from **text** files. Text files consist exclusively of ASCII characters which represent data in any of the primitive types provided by C++. Typically, the values are separated by spaces. For instance, let's assume that the file `nameAge.txt` contains some data about names and ages.
|
142
|
|
142
|
|
143
|
```
|
143
|
```
|
144
|
Tomas 34
|
144
|
Tomas 34
|
|
|
|
|
210
|
3. `close` the file at the end.
|
210
|
3. `close` the file at the end.
|
211
|
|
211
|
|
212
|
|
212
|
|
213
|
-**Example 1**: Read a file that consists only of integers, accumulate their values into a sum.
|
|
|
|
|
213
|
+**Example 1**: Read a file that consists only of integers, and accumulate their values into a sum.
|
214
|
|
214
|
|
215
|
```
|
215
|
```
|
216
|
ifstream inFile;
|
216
|
ifstream inFile;
|