Hey

#include <fcntl.h>
#include <io.h>
#include <iostream>
#include <fstream>
using namespace std;
//----------------------------------------------------------------------------

void Vampyre(int sk, int a, int b, int c, int d );

//----------------------------------------------------------------------------
int main ()
{

int sk, // four digits number
a, b, c, d; // four digits numbers.

fr << "Vampyro numbers:" ;
for (sk = 1000; sk <= 9999; sk = sk + 1) {
a = sk / 1000;
b = (sk / 100) % 10;
c = (sk / 10) % 10;
d = sk % 10;
Vampyre(sk, a, b, c, d);
Vampyre(sk, b, a, c, d);
Vampyre(sk, a, b, d, c);
Vampyre(sk, b, a, d, c);
Vampyre(sk, a, c, b, d);
Vampyre(sk, c, a, b, d);
Vampyre(sk, a, c, d, b);
Vampyre(sk, c, a, d, b);
Vampyre(sk, a, d, b, c);
Vampyre(sk, d, a, b, c);
Vampyre(sk, a, d, c, b);
Vampyre(sk, d, a, c, b);

}
return 0;
}
//----------------------------------------------------------------------------
void Vampyre(int sk, int a, int b, int c, int d)
{
if (sk == (a * 10 + b) * ( c * 10 + d))
ofstream fr("Vampyrai.txt");
fr << sk << " = " << a << b << " * " << c << d << endl;
fr.close();
return 0;


}
//----------------------------------------------------------------------------
Hey guys. Why this progeram is not writing the result into .txt file?
It's not writing the result into the .txt file because it doesn't even compile.
Topic archived. No new replies allowed.