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

Please answer this in C++ (Visual studio) Programing not jawa. Assume you have a

ID: 662966 • Letter: P

Question

Please answer this in C++ (Visual studio) Programing not jawa.

Assume you have a file inputData.txt. The file contains rows in the following form, where the first is the name of the athlete followed by his SSN number, then miles completed in a hiking contest, followed by the time spent in hours:

Arnauld        4567       33.2   7.4

Mamadou     6789       24.5   10.3

Li                  3219       25      11.3

- You are asked to write a program that creates a new file outputData.txt using inputData.txt, which rows will have the following format; SSN first, then name, miles and finally time:

M: 33.2 S: 4567   N: Arnauld   T: 7.4

M: 24.5 S: 6789 N: Mamadou T: 7.4

M: 25 S: 3219 N: Li T: 11.3

Explanation / Answer

#include <bits/stdc++.h>
using namespace std;

int main() {
   ifstream infile;
   infile.open("inputData.txt");
   ofstream outfile;
   outfile.open("outputData.txt");
   string s;
   vector<string> Token;
   while (!infile.eof()){
       getline(infile,s);
       Token.clear();
       stringstream line(s);
       string temp;
       while (line >> temp){
           Token.push_back(temp);
       }
       outfile << "M: " << Token[2] << " S: " << Token[1] << " N: " << Token[0] << " T: " << Token[3] << endl;
   }
   return 0;
}