Hi everyone, I am struggling with a program. It shows my file reading and writing (ifstream and ofstream) as errors and I can't understand why. Any ideas? (I learn programming in other language, so I hope you'll understand what I am trying to say.)
Last edited on
1. Please post some code. Most of us here have poor mind-reading capabilities.

2. Actually, there is no #2. I've got a wild guess what the problem might be, but I really don't want to tell you what it is because I don't want to confuse you if that's not the problem.
Hello Ilfau. When the compiler sends out errors to you, they can be hard to understand, but if possible you should still post the error here, otherwise, we can't help much.

You should show us both the program source code that is failing, and the compiler error message verbatim.
 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667`` ``````#include #include #include void nuskaitymas(int n, int M[], int D[], double W[], double B[], double R[]); void skaiciavimas(int & d,int & bd, int & rd, double W[], double R[], double B[],int n); const int Cmax=100; int main() { int n, M[Cmax], D[Cmax],d,bd,rd; double W[Cmax], B[Cmax], R[Cmax]; ofstream fr("Duomenys.txt"); nuskaitymas(n, M, D, W, B, R); skaiciavimas(d,bd,rd,W,R,B,n); fr<<"Derlingiausia diena "<>n; for(int i=0;i>M[i]<mas) { mas=W[i]; d=i; } } int bar=0; for(int g=0;gbar) { bar=B[g]; bd=g; } } int raud=0; for(int j=0;jraud) { raud=R[j]; rd=j; } } }``````

That's how a code looks like.
std::
Many times. (Or once if you employ "using namespace std;")

You also have some << where it should be >> on line 28.

Even allowing for the fact that I can't read your language, I can see that you might choose more meaningful names for variables.
Last edited on
Yeaah, thank you so much