Here is the code that I have right now:
Code:
# include <fstream> // for file streams for input and output
# include <iomanip> // for formatting manipulators
# include <string> //
using namespace std;
int main ( ) {
ifstream In("1.StockData.txt"); // Open the input file
ofstream Out("Summary.txt"); // Open the output file
string CName, // Name of Customer
AccountNum, // Customer's Account Number
Date, // Date of Report
SName; // Name of the stock
int Shares, // Number of shares held
OpenDollar, // Opening price dollars
OpenCents, // Opening price cents
TotalOpen, // Total opening price
CloseDollar, // Closing price dollars
CloseCents, // Closing price cents
TotalClose, // Total closing price
UnitChange, // Gain or loss of each share
TotalChange; // Gain or loss of total value of shares
double PerChange; // Percentage change of value of a single share
// Write the header information to the output file:
Out << "Programmer: Danielle Barry" << endl;
Out << "CS 1044 Simple Stock Trader" << endl;
Out << endl; // Output a blank line for separation
// Read the customer name:
getline(In, CName);
// Read account number and date:
In >> AccountNum >> Date;
// Write the data to the output file:
Out << "Customer:"
<< setw(41) << CName
<< setw(17) << AccountNum
<< endl;
Out << "Date:"
<< setw(11) << Date
<< endl;
}
[edit]Code tags added by Hammer. dellebelle751: read Salem's post.