I'm trying to read this input from a text file but whenever I try to output it, it shows up as 00000.
Input:
IBM 100 93.2 98.6
MER 200 67.2 43.89
QQQ 300 78.9 70.0
C 200 35.78 50.02
CSCO 400 45.67 57.23
This is what I have so far:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
string stockName;
double numShares, buyPrice, currPrice;
ifstream inFile;
ofstream outFile;
inFile.open("C:\\text1.txt");
outFile.open("C:\\text2.txt");
if (!inFile)
{
cout << "Unable to open file";
}
inFile>>stockName>>numShares>>buyPrice>>currPrice;
outFile<<inFile; //Checking to see if it works.
inFile.close();
outFile.close();
return 0;
}