Programming Language : C++ Use the C++ code below, to complete this. Create a .c
ID: 3864033 • Letter: P
Question
Programming Language : C++
Use the C++ code below, to complete this. Create a .csv file, paste this information below
Cross Shaina 12 Corrigan Ct Benicia CT 94510-2578 12.25 10.25
Nephyr Alysha 1748 Legend Cir Chelie CT 53248 10.25 14
Hellen Bernardo 1043 Amndo Avenue Ridgeside CT 44561 10.25 21
Colen Georgene 1435 Bayside Ct Mountain CT 44433-3147 13 21.75
Walters Ted 1115 Estes Ct York City CT 43522 10.5 16.5
Powers Denny 2530 Georgia Ct Newwater CT 44591-4934 15.5 21
Charlie Santos 307 Amberfall Circle Jersey CT 44532-1681 10.5 13.5
a.
Hint: The code you have been given reads all of the fields in each record as strings. You will need to convert wage and hours to float (or double) and perform the multiplication before writing the pay data to the output file.
#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
ifstream inFile;
string szSourcePath = // path of input file, change to your file location, if necessary
"test.csv";
ofstream outFile;
string szDestPath =
"out.csv"; // path of output file, change to your file location, if necessary
string szLastName;
string szFirstName;
string szAddress;
string szCity;
string szState;
string szZip;
string szWage;
string szHours;
string szPay;
inFile.open(szSourcePath);
outFile.open(szDestPath);
// this code reads the first line of the input file only
// insert loop to read entire file here
getline( inFile, szLastName, ',');
getline( inFile, szFirstName, ',');
getline( inFile, szAddress, ',');
getline( inFile, szCity, ',');
getline( inFile, szState, ',');
getline( inFile, szZip, ',');
getline( inFile, szWage, ',');
getline( inFile, szHours, ' ');
// calculate pay here
// insert write to output file here
inFile.close();
outFile.close();
system("Pause");
return 0;
}
Explanation / Answer
The C++ Programming Language was the first book to describe the C++ programming language, written by the language’s creator, Bjarne Stroustrup, and first published in October 1985. In the absence of an official standard, the book served for several years as the de facto documentation for the evolving C++ language until the release of the ISO/IEC 14882:1998: Programming Language C++ standard on 1 September 1998. As the standard further evolved with the standardization of language and library extensions and with the publication of technical corrigenda, later editions of the book were updated to incorporate the new changes.
History[edit]
The first edition of The C++ Programming Language was published in 1985. As C++ evolved, a second edition was published in July 1991, reflecting the changes made.
The third edition of the book was first published on 30 June 1997; a hardcover version of the third edition, with two new appendices, was later published as The C++ Programming Language: Special Edition on 11 February 2000. Both the softcover third edition and the hardcover “special edition” have since undergone several reprintings, with corrections.[2]
C++ Solutions (ISBN 0-201-30965-3) is a companion book to the third edition of The C++ Programming Language. It contains solutions to selected exercises of The C++ Programming Language.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.