Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Programming This is the content of pb_2014.txt 01/01/14 15 24 40 48 52 23 x

ID: 3598699 • Letter: C

Question

C++ Programming

This is the content of pb_2014.txt

01/01/14 15 24 40 48 52 23 x PP

01/04/14 19 20 37 41 58 14 x PP

01/08/14 10 28 39 47 58 22 x PP

01/11/14 10 15 33 48 54 34 x PP

01/15/14 07 08 09 24 29 25 x PP

01/18/14 13 14 19 31 38 25 x PP

01/22/14 01 02 07 09 55 29 x 03

01/25/14 08 12 18 55 57 02 x 02

01/29/14 11 23 28 32 47 20 x 02

02/01/14 05 12 15 27 38 07 x 02

02/05/14 08 17 32 57 59 24 x 03

02/08/14 24 25 34 37 54 29 x 02

02/12/14 36 44 49 52 57 01 x 02

02/15/14 02 09 14 21 23 03 x 03

02/19/14 01 17 35 49 54 34 x 03

02/22/14 02 03 13 14 54 04 x 05

02/26/14 11 12 17 38 42 02 x 02

03/01/14 03 08 25 30 47 13 x 04

03/05/14 03 07 09 26 54 19 x 02

03/08/14 10 14 24 32 41 30 x 02

03/12/14 14 15 28 37 54 10 x 02

03/15/14 02 05 34 51 58 09 x 04

03/19/14 02 19 23 34 43 14 x 02

03/22/14 13 28 31 55 58 15 x 02

03/26/14 28 33 41 44 59 21 x 02

03/29/14 02 03 12 27 38 17 x 02

04/02/14 08 13 19 22 53 24 x 02

04/05/14 11 21 26 33 34 29 x 05

04/09/14 09 14 44 48 49 29 x 02

04/12/14 14 26 45 54 55 20 x 02

04/16/14 34 39 42 44 59 08 x 03

04/19/14 05 06 29 35 51 21 x 05

04/23/14 19 25 29 36 48 12 x 04

04/26/14 03 07 22 30 33 20 x 03

04/30/14 02 09 11 19 50 32 x 03

05/03/14 05 15 16 46 49 26 x 04

05/07/14 17 29 31 48 49 34 x 02

05/10/14 04 31 41 47 55 01 x 02

05/14/14 07 33 39 52 55 33 x 03

05/17/14 23 32 39 47 49 22 x 03

05/21/14 04 20 34 39 58 31 x 05

05/24/14 15 16 28 49 55 18 x 02

05/28/14 02 24 28 32 59 25 x 03

05/31/14 15 27 31 34 48 01 x 02

06/04/14 01 07 10 22 49 24 x 03

06/07/14 28 30 35 58 59 15 x 02

06/11/14 14 18 25 33 49 23 x 05

06/14/14 09 33 42 45 54 30 x 03

06/18/14 06 09 29 52 59 07 x 03

06/21/14 05 06 37 41 54 26 x 03

06/25/14 10 20 25 50 53 35 x 04

06/28/14 08 12 34 43 56 09 x 02

07/02/14 08 18 45 53 58 35 x 02

07/05/14 24 34 36 57 58 11 x 04

07/09/14 09 25 42 55 57 14 x 02

07/12/14 02 03 07 23 51 26 x 02

07/16/14 05 15 18 26 32 35 x 03

07/19/14 10 17 25 45 53 09 x 02

07/23/14 04 10 12 22 31 03 x 05

07/26/14 24 28 30 38 39 16 x 02

07/30/14 13 30 42 49 53 29 x 03

08/02/14 12 26 44 46 47 29 x 02

08/06/14 01 08 24 28 49 24 x 05

08/09/14 03 12 31 34 51 24 x 02

08/13/14 08 37 39 40 52 24 x 02

08/16/14 07 08 17 48 59 09 x 02

08/20/14 04 08 21 38 40 03 x 02

08/23/14 28 32 35 36 52 31 x 03

08/27/14 17 24 26 45 46 19 x 03

08/30/14 05 28 31 52 59 27 x 02

09/03/14 02 16 43 45 51 35 x 03

09/06/14 09 29 31 43 50 18 x 02

09/10/14 02 14 39 40 43 13 x 05

09/13/14 01 06 16 37 53 27 x 03

09/17/14 18 25 36 48 50 23 x 02

09/20/14 22 23 30 37 39 16 x 04

09/24/14 07 14 21 24 41 26 x 04

09/27/14 02 11 35 52 54 13 x 03

10/01/14 01 04 18 20 45 07 x 02

10/04/14 13 18 24 25 33 31 x 02

10/08/14 05 16 31 46 50 18 x 03

10/11/14 10 19 37 38 39 28 x 02

10/15/14 05 07 19 27 28 20 x 02

10/18/14 20 26 27 36 54 19 x 02

10/22/14 29 30 40 42 50 16 x 02

10/25/14 06 10 51 54 57 12 x 02

10/29/14 25 28 48 57 59 16 x 03

11/01/14 01 03 13 25 38 17 x 02

11/05/14 02 11 19 21 42 34 x 03

11/08/14 09 19 33 38 54 15 x 03

11/12/14 37 39 51 52 55 11 x 03

11/15/14 13 16 33 35 51 28 x 02

11/19/14 06 36 38 48 51 17 x 02

11/22/14 23 49 53 54 57 35 x 02

11/26/14 16 17 22 46 54 35 x 05

11/29/14 13 24 30 42 48 27 x 02

12/03/14 25 30 32 46 54 26 x 03

12/06/14 12 15 22 43 49 14 x 02

12/10/14 34 44 48 54 55 10 x 02

12/13/14 05 13 28 43 55 33 x 03

12/17/14 22 31 38 47 48 15 x 03

12/20/14 14 15 19 31 56 05 x 05

12/24/14 11 12 46 47 50 22 x 04

12/27/14 07 10 11 14 36 15 x 02

12/31/14 17 27 37 40 53 35 x 02

Exercise 1 You are interested in analyzing the frequency of numbers selected for the Powerball lottery. You have downloaded the previous year's Powerball numbers which are saved in a text file called pb_2014.txt and each record in the file has the following format: 01/01/14 15 24 40 48 52 23 x PP 01/04/14 19 20 37 41 58 14 x PP 01/08/14 10 28 39 47 58 22 x PP 01/11/14 10 15 33 48 54 34 x PP Unfortunately this is an incompatible file format for the program you are using to analyze the frequency. The correct record file format needed by the program is shown below: 15 24 40 48 52 2.3 19 20 37 41 58 14 10 28 39 47 58 22 10 15 33 48 54 3-4 Write a program to convert the pb_2014.txt file into the required file format shown above saving the nevw format to the file powerball.txt. Copy and paste your program into your word document. Copy and paste the first 10 records of each file directly below your program.

Explanation / Answer

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main()
{
ifstream infile("pb_2014.txt");
ofstream outfile("powerball.txt");
string line;
while (getline(infile, line))
{
line = line.substr(line.find(' ') + 1);
line = line.substr(0, line.find(" x"));
outfile << line << endl;
}
infile.close();
outfile.close();
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote