Hello, i'm learning to use external files in c++. I've created file duom.txt for initial data and file ats.txt for results data. My simple program manages to read an initial number from duom.txt, but for some reason it does not make an output to results file ats.txt. Maybe i've ,made some error, i can't find it... Please help :)
here is my code:
#include <cmath>
#include <fstream>
using namespace std;
int main()
{
float skaicius;
float Saknis;
ifstream fd ("duom.txt");
fd >> skaicius;
fd.close();
Saknis = sqrt (skaicius);
ofstream fr ("ats.txt");
fr << Saknis;
fr.close();
return 0;
}
Console says:
Reading symbols from a.out...
(gdb) run
Starting program: /home/a.out
[Inferior 1 (process 3326) exited normally]
(gdb)
Thanks for help :)