Answered step by step
Verified Expert Solution
Question
1 Approved Answer
i cant add the text file so i uploaded a picture of it. i need this to run in C++ program. i am using Microsoft
i cant add the text file so i uploaded a picture of it. i need this to run in C++ program. i am using Microsoft Visual Studio 2013.
Lab 2 2021 Write a program that reads the text file named find-it.txt attached to this assignment. Find every occurrence of the letter P. Once that letter is found, immediately read second character. If that letter is an N, immediately read an integer, and write the first character, second character, a space, and the number to a file. Start a new line for each occurrence like this. Comment each line that uses an if statement. Don't comment any other command lines. If you use a loop, precede that loop with a comment stating what is supposed to happen in that loop. find_it (1 page) U PD; PN-973, 1622;PN463,314; PU; PN154,-1340;PD; PN2444,77;PN1844, -1521; PN44 25,-268; PU; PN-2119,-3574;PD; PN-2119.-3719;PU; PN-2119,-3755;PD;PN-2119, -3792;PU; PN-2228,-3792;PD;PN-2192,-3755;PU; PN-2264,-3755;PD; PN-2228,-3 792; PU; PN-2264,-3755;PD; PN-2264,-3574; PU; PN-2192,-3647;PD;PN-2337,-364 7;PU-2446,-3647;PD;PN-2410,-3683; PN-2410,-3792;PU-2555,-3792;PD;PN-255 5,-3574; PU-2555,-3719;PD; PN-2482,-3647;PN-2446,-3647;PU; PN-2627,-3683; PD: PN-2664,-3647; PN-2736,-3647;PN-2772,-3683; PN-2772,-3755;PN-2736,-37 92;PN-2627.-3792;PU; PN-2627,-3828;PD; PN-2627,-3683; PU-2627,-3828;PD;PN -2664,-3864; PN-2736,-3864;PN-2772,-3828; PU-2845,-3792;PD; PN-2845,-3647 ;PU; PN-2845,-3610;PD;PN-2845,-3574; PU;PN-2954,-3574;PD; PN-2918,-3610;P N-2918, -3647;PN-2954,-3683; PN-3063, -3683; PU; PN-3826, -3683;PD; PN-2918,- 3792; PU; PN-3063,-3792;PD; PN-3063,-3574; PN-2954,-3574; PN-4280, 1058;PD;P N-973, 1622;PN463, 314; PU; PN154, -1340;PD;PN2444,77;PN1844, -1521; PN4425,- 268; PU; PN-2119,-3574;PD; PN-2119.-3719; PU; PN-2119,-3755;PD; PN-2119,-379 2;PU;PN-2228,-3792;PD;PN-2192,-3755;PU; PN-2264,-3755;PD;PN-2228, -3792; PU; PN-2264,-3755;PD; PN-2264,-3574; PU; PN-2192,-3647;PD;PN-2337,-3647; PU -2446,-3647;PD; PN-2410,-3683; PN-2410,-3792; PU-2555,-3792;PD; PN-2555,-3 574; PU-2555,-3719;PD; PN-2482, -3647;PN-2446,-3647;PU; PN-2627,-3683;PD;P N-2664,-3647;PN-2736,-3647;PN-2772,-3683; PN-2772,-3755;PN-2736,-3792;P N-2627,-3792;PU; PN-2627,-3828;PD; PN-26277-3683; PU-2627,-3828;PD;PN-266 4,-3864;PN-2736,-3864;PN-2772,-3828;PU-2845,-3792;PD;PN-2845,-3647;PU; PN-2845,-3610;PD; PN-2845,-3574; PU; PN-2954,-3574;PD;PN-2918, -3610;PN-29 18,-3647;PN-2954,-3683; PN-3063, -3683; PU; PN-3026,-3683;PD; PN-2918,-3792 ;PU; PN-3063,-3792;PD; PN-3863,-3574;PN-2954,-3574;PN-4280, 1058;PD; PN-97 3,1622;PN463,314;PU; PN154, -1340;PD; PN2444,77;PN1844, -1521;PN4425,-268; PU; PN-2119,-3574;PD; PN-2119,-3719;PU; PN-2119,-3755;PD;PN-2119,-3792; PU ;PN-2228,-3792;PD; PN-2192,-3755;PU;PN-2264,-3755;PD;PN-2228,-3792; PU;P N-2264,-3755;PD; PN-2264,-3574; PU; PN-2192,-3647;PD;PN-2337, -3647, PU-244 6,-3647;PD; PN-2410,-3683; PN-2410,-3792: PU-2555,-3792;PD; PN-2555,-3574; PU-2555,-3719;PD;PN-2482, -3647;PN-2446,-3647;PU; PN-2627,-3683; PD; PN-26 64,-3647;PN-2736,-3647;PN-2772,-3683; PN-2772,-3755;PN-2736,-3792;PN-26 27,-3792; PU; PN-2627,-3828;PD;PN-2627,-3683; PU-2627,-3828;PD; PN-2664,-3 864;PN-2736,-3864; PN-2772, -3828; PU-2845,-3792;PD;PN-2845,-3647;PU; PN-2 845,-3610;PD; PN-2845,-3574;PU; PN-2954,-3574;PD;PN-2918,-3610;PN-2918,- 3647;PN-2954,-3683; PN-3063,-3683; PU; PN-3026,-3683;PD;PN-2918, -3792;PU; PN-3063,-3792;PD; PN-3063,-3574; PN-2954, -3574;PN-4280, 1058;PD; PN-973,16 22;PN463,314; PU; PN154,-1348;PD; PN2444,77;PN1844,-1521; PN4425,-268; PU;P N-2119, -3574;PD; PN-2119,-3719; PU;PN-2119,-3755;PD; PN-2119, -3792;PU: PN- 2228,-3792;PD; PN-2192,-3755;PU;PN-2264,-3755;PD; PN-2228,-3792: PU; PN-22 64,-3755;PD;PN-2264,-3574; PU;PN-2192,-3647;PD;PN-2337,-3647;PU-2446,-3 647;PD; PN-2410,-3683; PN-2410,-3792; PU-2555,-3792;PD;PN-2555,-3574; PU-2 555,-3719;PD: PN-2482, -3647; PN-2446,-3647;PU; PN-2627, -3683; PD: PN-2664,- 3647;PN-2736,-3647;PN-2772,-3683; PN-2772,-3755; PN-2736,-3792;PN-2627,- 3792;PU;PN-2627,-3828;PD; PN-2627,-3683; PU-2627,-3828;PD;PN-2664,-3864; PN-2736,-3864; PN-2772,-3828; PU-2845,-3792;PD;PN-2845, -3647;PU; PN-2845, -3610;PD; PN-2845,-3574; PU; PN-2954,-3574;PD; PN-2918,-3610;PN-2918, -3647 PN-2954,-3683; PN-3063, -3683;PU: PN-3026,-3683;PD; PN-2918,-3792; PU; PN-3 063,-3792;PD;PN-3063, -3574;PN-2954,-3574; PN-4280, 1858: Lab 2 2021 Write a program that reads the text file named find-it.txt attached to this assignment. Find every occurrence of the letter P. Once that letter is found, immediately read second character. If that letter is an N, immediately read an integer, and write the first character, second character, a space, and the number to a file. Start a new line for each occurrence like this. Comment each line that uses an if statement. Don't comment any other command lines. If you use a loop, precede that loop with a comment stating what is supposed to happen in that loop. find_it (1 page) U PD; PN-973, 1622;PN463,314; PU; PN154,-1340;PD; PN2444,77;PN1844, -1521; PN44 25,-268; PU; PN-2119,-3574;PD; PN-2119.-3719;PU; PN-2119,-3755;PD;PN-2119, -3792;PU; PN-2228,-3792;PD;PN-2192,-3755;PU; PN-2264,-3755;PD; PN-2228,-3 792; PU; PN-2264,-3755;PD; PN-2264,-3574; PU; PN-2192,-3647;PD;PN-2337,-364 7;PU-2446,-3647;PD;PN-2410,-3683; PN-2410,-3792;PU-2555,-3792;PD;PN-255 5,-3574; PU-2555,-3719;PD; PN-2482,-3647;PN-2446,-3647;PU; PN-2627,-3683; PD: PN-2664,-3647; PN-2736,-3647;PN-2772,-3683; PN-2772,-3755;PN-2736,-37 92;PN-2627.-3792;PU; PN-2627,-3828;PD; PN-2627,-3683; PU-2627,-3828;PD;PN -2664,-3864; PN-2736,-3864;PN-2772,-3828; PU-2845,-3792;PD; PN-2845,-3647 ;PU; PN-2845,-3610;PD;PN-2845,-3574; PU;PN-2954,-3574;PD; PN-2918,-3610;P N-2918, -3647;PN-2954,-3683; PN-3063, -3683; PU; PN-3826, -3683;PD; PN-2918,- 3792; PU; PN-3063,-3792;PD; PN-3063,-3574; PN-2954,-3574; PN-4280, 1058;PD;P N-973, 1622;PN463, 314; PU; PN154, -1340;PD;PN2444,77;PN1844, -1521; PN4425,- 268; PU; PN-2119,-3574;PD; PN-2119.-3719; PU; PN-2119,-3755;PD; PN-2119,-379 2;PU;PN-2228,-3792;PD;PN-2192,-3755;PU; PN-2264,-3755;PD;PN-2228, -3792; PU; PN-2264,-3755;PD; PN-2264,-3574; PU; PN-2192,-3647;PD;PN-2337,-3647; PU -2446,-3647;PD; PN-2410,-3683; PN-2410,-3792; PU-2555,-3792;PD; PN-2555,-3 574; PU-2555,-3719;PD; PN-2482, -3647;PN-2446,-3647;PU; PN-2627,-3683;PD;P N-2664,-3647;PN-2736,-3647;PN-2772,-3683; PN-2772,-3755;PN-2736,-3792;P N-2627,-3792;PU; PN-2627,-3828;PD; PN-26277-3683; PU-2627,-3828;PD;PN-266 4,-3864;PN-2736,-3864;PN-2772,-3828;PU-2845,-3792;PD;PN-2845,-3647;PU; PN-2845,-3610;PD; PN-2845,-3574; PU; PN-2954,-3574;PD;PN-2918, -3610;PN-29 18,-3647;PN-2954,-3683; PN-3063, -3683; PU; PN-3026,-3683;PD; PN-2918,-3792 ;PU; PN-3063,-3792;PD; PN-3863,-3574;PN-2954,-3574;PN-4280, 1058;PD; PN-97 3,1622;PN463,314;PU; PN154, -1340;PD; PN2444,77;PN1844, -1521;PN4425,-268; PU; PN-2119,-3574;PD; PN-2119,-3719;PU; PN-2119,-3755;PD;PN-2119,-3792; PU ;PN-2228,-3792;PD; PN-2192,-3755;PU;PN-2264,-3755;PD;PN-2228,-3792; PU;P N-2264,-3755;PD; PN-2264,-3574; PU; PN-2192,-3647;PD;PN-2337, -3647, PU-244 6,-3647;PD; PN-2410,-3683; PN-2410,-3792: PU-2555,-3792;PD; PN-2555,-3574; PU-2555,-3719;PD;PN-2482, -3647;PN-2446,-3647;PU; PN-2627,-3683; PD; PN-26 64,-3647;PN-2736,-3647;PN-2772,-3683; PN-2772,-3755;PN-2736,-3792;PN-26 27,-3792; PU; PN-2627,-3828;PD;PN-2627,-3683; PU-2627,-3828;PD; PN-2664,-3 864;PN-2736,-3864; PN-2772, -3828; PU-2845,-3792;PD;PN-2845,-3647;PU; PN-2 845,-3610;PD; PN-2845,-3574;PU; PN-2954,-3574;PD;PN-2918,-3610;PN-2918,- 3647;PN-2954,-3683; PN-3063,-3683; PU; PN-3026,-3683;PD;PN-2918, -3792;PU; PN-3063,-3792;PD; PN-3063,-3574; PN-2954, -3574;PN-4280, 1058;PD; PN-973,16 22;PN463,314; PU; PN154,-1348;PD; PN2444,77;PN1844,-1521; PN4425,-268; PU;P N-2119, -3574;PD; PN-2119,-3719; PU;PN-2119,-3755;PD; PN-2119, -3792;PU: PN- 2228,-3792;PD; PN-2192,-3755;PU;PN-2264,-3755;PD; PN-2228,-3792: PU; PN-22 64,-3755;PD;PN-2264,-3574; PU;PN-2192,-3647;PD;PN-2337,-3647;PU-2446,-3 647;PD; PN-2410,-3683; PN-2410,-3792; PU-2555,-3792;PD;PN-2555,-3574; PU-2 555,-3719;PD: PN-2482, -3647; PN-2446,-3647;PU; PN-2627, -3683; PD: PN-2664,- 3647;PN-2736,-3647;PN-2772,-3683; PN-2772,-3755; PN-2736,-3792;PN-2627,- 3792;PU;PN-2627,-3828;PD; PN-2627,-3683; PU-2627,-3828;PD;PN-2664,-3864; PN-2736,-3864; PN-2772,-3828; PU-2845,-3792;PD;PN-2845, -3647;PU; PN-2845, -3610;PD; PN-2845,-3574; PU; PN-2954,-3574;PD; PN-2918,-3610;PN-2918, -3647 PN-2954,-3683; PN-3063, -3683;PU: PN-3026,-3683;PD; PN-2918,-3792; PU; PN-3 063,-3792;PD;PN-3063, -3574;PN-2954,-3574; PN-4280, 1858 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started