hello, i wrote a little program, but There are some problems.
Can anyone help me?

here is the code:

#include <iostream>
#include <math.h>
#include <fstream>

using namespace std;


bool tikrinimas(const char *filename)
{
  ifstream failas(filename);

  return failas;
}


int main ()
{
	tikrinimas("example.txt");
	
	bool failas;

	if (failas==true)

{cout << "good";}

else
{cout <<"bad";}


system("PAUSE");
return 0;
}

You neglected to mention the problems.

The problem, that failas is always false...

Probably because you meant to initialize it:

bool failas = tikrinimas("example.txt");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.