I am currently trying to place the numbers in the file into the array. I keep getting the following error "invalid operands of types 'char [16]' and 'int' to binary 'operator>>'
in_file_name >> sales[i]"
#include <iostream>
#include <fstream>
usingnamespace std;
int main()
{
int first, sales[20], i;
char sales_file;
ifstream in_stream;
cout << "What is the name of the file for the sales?\n";
cin >> sales_file;
in_stream.open(in_file_name);
for(i = 0; i < 20; ++i)
{
sales_file >> sales[i]
}
in_stream.close();
}
"its not working" is not a helpful description of the problem. What is the problem? A compiler error? A linker error? A runtime crash? Some other behaviour?
It may surprise you to learn that very few of us here on this forum are telepaths. There's a remarkably low overlap between telepaths and software developers - don't ask me why, but those pesky telepaths just don't seem to be interested in C++ like we non-telepaths are.
One unfortunate consequence of this is that we can't read your mind. We can't magically know what you are seeing on your computer. If you want us to help you with a problem, you have to give us all the information about that problem.