Language: C++

int main()
{
	ifstream ifp("c:\\temp\\small-practice.in");
	ofstream ofp("c:\\temp\\res.out");
	istream & input = cin;
	ostream & output = cout;


	// p1
	if ( false)
	{
		int a, b;
		input >> a;
		input >> b;
		if (a + b == 15)
			output << "+";
		else if (a * b == 15)
			output << "*";
		else
			output << "x";
	}

	// p2
	if(false)
	{
		string s;
		int w;
		input >> s;
		input >> w;

		stringstream ss;
		ss << s[0];
		for (int i = 1; i < s.length(); i++) {
			if ((i % w) == 0)
				ss << s[i];
		}

		output << ss.str();
	}

	// p3
	{
		int m, d;
		float n;
		input >> n;
		input >> m;
		input >> d;

		float chanceOf2 = (n - (2 * d)) / n;
		if (d == 0)
			chanceOf2 = 0;
		float p = 1 / n * (1 - chanceOf2) + 1 / (n / 2) * chanceOf2;
		float res = p * (m - 1);
		output << fixed << showpoint << std::setprecision(20) << res;
	}

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:3:9: error: 'ifstream' was not declared in this scope
    3 |         ifstream ifp("c:\\temp\\small-practice.in");
      |         ^~~~~~~~
a.cc:4:9: error: 'ofstream' was not declared in this scope
    4 |         ofstream ofp("c:\\temp\\res.out");
      |         ^~~~~~~~
a.cc:5:9: error: 'istream' was not declared in this scope
    5 |         istream & input = cin;
      |         ^~~~~~~
a.cc:5:19: error: 'input' was not declared in this scope; did you mean 'int'?
    5 |         istream & input = cin;
      |                   ^~~~~
      |                   int
a.cc:5:27: error: 'cin' was not declared in this scope
    5 |         istream & input = cin;
      |                           ^~~
a.cc:6:9: error: 'ostream' was not declared in this scope
    6 |         ostream & output = cout;
      |         ^~~~~~~
a.cc:6:19: error: 'output' was not declared in this scope
    6 |         ostream & output = cout;
      |                   ^~~~~~
a.cc:6:28: error: 'cout' was not declared in this scope
    6 |         ostream & output = cout;
      |                            ^~~~
a.cc:26:17: error: 'string' was not declared in this scope
   26 |                 string s;
      |                 ^~~~~~
a.cc:28:26: error: 's' was not declared in this scope
   28 |                 input >> s;
      |                          ^
a.cc:31:17: error: 'stringstream' was not declared in this scope
   31 |                 stringstream ss;
      |                 ^~~~~~~~~~~~
a.cc:32:17: error: 'ss' was not declared in this scope
   32 |                 ss << s[0];
      |                 ^~
a.cc:54:27: error: 'fixed' was not declared in this scope
   54 |                 output << fixed << showpoint << std::setprecision(20) << res;
      |                           ^~~~~
a.cc:54:36: error: 'showpoint' was not declared in this scope
   54 |                 output << fixed << showpoint << std::setprecision(20) << res;
      |                                    ^~~~~~~~~
a.cc:54:54: error: 'setprecision' is not a member of 'std'
   54 |                 output << fixed << showpoint << std::setprecision(20) << res;
      |                                                      ^~~~~~~~~~~~
a.cc:1:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
  +++ |+#include <iomanip>
    1 | int main()