Hi there, This is my first post so I apologies in advance if the format if off.
This is an error message Im getting for my code (which I'll leave at the bottom)
error C2679: binary '>>' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion)
Error executing cl.exe.
If anyone could point my where Im going wrong it would be much appreciated.
Ps: Im using Visual Studio v6
#include <iostream>
#include <fstream>
#include <string>
#include <conio.h>
using namespace std;
int main()
{
double vArray[15];
int index=0;
ifstream filein;
string filename;
// Open the file: this links the program variable "filein" with the disk file
filename = "filedata.txt";
filein.open( filename.c_str() );
if (filein.good())
{
filein >> vArray[index];
while ( filein.good() )
{
for (index=0; index<15; index++)
{
filein >> vArray[index] >> endl;
}
}
filein.close();
}
else
{// moan - it could be that there is no file with that name
cout << "***ERROR could not open file " << filename << "***" << endl;
}
return 0;
}
This is an error message Im getting for my code (which I'll leave at the bottom)
error C2679: binary '>>' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion)
Error executing cl.exe.
If anyone could point my where Im going wrong it would be much appreciated.
Ps: Im using Visual Studio v6
#include <iostream>
#include <fstream>
#include <string>
#include <conio.h>
using namespace std;
int main()
{
double vArray[15];
int index=0;
ifstream filein;
string filename;
// Open the file: this links the program variable "filein" with the disk file
filename = "filedata.txt";
filein.open( filename.c_str() );
if (filein.good())
{
filein >> vArray[index];
while ( filein.good() )
{
for (index=0; index<15; index++)
{
filein >> vArray[index] >> endl;
}
}
filein.close();
}
else
{// moan - it could be that there is no file with that name
cout << "***ERROR could not open file " << filename << "***" << endl;
}
return 0;
}