We just started class today and im having major memory blockage when it comes to programming even though the last class was only a few months ago...
Problem description: The text file DJI.txt contains the information of a stock market index --
Dow Jones Industrial Average Index (DJI for short) -- for a continuous time
in year 2008. Each line contains the date and the DJI's value on that day.
For the format of the file, please view DJI.txt.
Please write a program that reads DJI values stored in the data file DJI.txt,
and finds out the date with highest DJI value during this period stored in the file.
*/
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
int day; //Today's day
int maxDay; //The day of the date with max. DJI
string month; //Today's month
string maxMonth; //The month of the date with max. DJI
double maxDJI; //The max. DJI value got so far.
double dji; //Today's DJI
ifs.open( inputFile.c_str() ); //open the file
//INSERT WHILE LOOP HERE
// this is what i have come up with so far
you'll want to run the while() loop as far as you have not reached the end of the DJI.txt file, right?
i think fstream can check which line of the external file you are at the moment.