Hi, I've had a quick look through this forum and can't really see anything to help. I've got a basic but fair knowldge of C++ but I'm unfortunately not very good at putting my knowledge into raw code :D.
I'm currently doing an assignment to read data from one of four comma separated files and perfom various calculations on each relevant item of data. Each of the four files contain roughly 160,000 entries in the following way -
Thu Feb 01 12:00:00 GMT 1990, 11.317777768
Thu Feb 01 13:00:00 GMT 1990, 10.803333324
The part I'm having difficulty with is reading the number found after the comma, passing it through the relevant code to perform the calculations (I have the code for the calculations running smoothly) and outputting the data gained in a new comma separated file.
I'm using the below code to access the file of choice by the user, but I'm unsure of how to read the data off of the file and pass each one through a loop to calculate the necessary data.
#include <iostream>
#include <fstream>
#include <string>
#include <ctime>
#include <Math.h>
using namespace std;
int main()
{
//Trying to get the windspeeds
string myfilename, mystring;
cout << "Enter the name of the Wind Farm\n";
cin >> myfilename;
ifstream inFile;
inFile.open(myfilename.c_str());
if (!inFile){
cout << "Error opening file " << myfilename << endl;
return -1;
}
while(!inFile.eof()) {};
I've already declared a variable, v, to set as the number found after the comma.
Any help / cheeky hints would be grateful. Sorry if I've not layed this out properly also, it's my first time using these forums :$!