Language: C++

#include <iostream>
#include <array>

class Baseball{
private:
	int point;
	int out;
	int base;   //0:no runner 1:runner
				//home,third,second,first

public:

	Baseball(){
		point = 0;
		out = 0;
		base = 0;
	}

	int point(){
		return point;
	}

	int out(){
		return out;
	}

	int hit(){
		base = (base * 10) + 1;
		
		if(base >= 1000){
			base -= 1000;
			point += 1;
		}
	}

	int home_run(){
		point += 1;
		for(int i = base; i > 0; i /= 10){
			point += i%10;
		}
		base = 0;
	}

	int get_out(){
		out += 1;
	}
	

int main(){

	int N;
	std::cin >> N;

	for(int i = 0; i < N; ++i){
		Baseball baseball();

		while(baseball.out() != 3){
			std::string str;
			cin >> str;

			if(str == "HIT")
				baseball.hit();
			
			else if(str == "HOMERUN")
				baseball.home_run();

			else if(str == "OUT")
				baseball.get_out();

		}

		std::cout >> baseball.point() >> endl;
	}

	return 0;
{
	

Compiler output:
a.cc:21:9: error: 'int Baseball::point()' conflicts with a previous declaration
   21 |         }
      |         ^
a.cc:6:13: note: previous declaration 'int Baseball::point'
    6 |         int point;
      |             ^~~~~
a.cc:25:9: error: 'int Baseball::out()' conflicts with a previous declaration
   25 |         }
      |         ^
a.cc:7:13: note: previous declaration 'int Baseball::out'
    7 |         int out;
      |             ^~~
a.cc:76:2: error: expected '}' at end of input
   76 | {
      |  ^
a.cc:4:15: note: to match this '{'
    4 | class Baseball{
      |               ^
a.cc: In member function 'int Baseball::hit()':
a.cc:34:9: warning: no return statement in function returning non-void [-Wreturn-type]
   34 |         }
      |         ^
a.cc: In member function 'int Baseball::home_run()':
a.cc:42:9: warning: no return statement in function returning non-void [-Wreturn-type]
   42 |         }
      |         ^
a.cc: In member function 'int Baseball::get_out()':
a.cc:46:9: warning: no return statement in function returning non-void [-Wreturn-type]
   46 |         }
      |         ^
a.cc: In member function 'int Baseball::main()':
a.cc:55:34: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   55 |                 Baseball baseball();
      |                                  ^~
a.cc:55:34: note: remove parentheses to default-initialize a variable
   55 |                 Baseball baseball();
      |                                  ^~
      |                                  --
a.cc:55:34: note: or replace parentheses with braces to value-initialize a variable
a.cc:57:32: error: request for member 'out' in 'baseball', which is of non-class type 'Baseball()'
   57 |                 while(baseball.out() != 3){
      |                                ^~~
a.cc:59:25: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   59 |                         cin >> str;
      |                         ^~~
      |                         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:62:42: error: request for member 'hit' in 'baseball', which is of non-class type 'Baseball()'
   62 |                                 baseball.hit();
      |                                          ^~~
a.cc:65:42: error: request for member 'home_run' in 'baseball', which is of non-class type 'Baseball()'
   65 |                                 baseball.home_run();
      |                                          ^~~~~~~~
a.cc:68:42: error: request for member 'get_out' in 'baseball', which is of non-class type 'Baseball()'
   68 |                                 baseball.get_out();
      |                                          ^~~~~~~
a.cc:72:39: error: request for member 'point' in 'baseball', which is of non-class type 'Baseball()'
   72 |                 std::cout >> baseball.point() >> endl;
      |                                       ^~~~~
a.cc:72:50: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   72 |                 std::cout >> baseball.point() >> endl;
      |                                                  ^~~~
      |                                                  std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:76:2: error: expected '}' at end of input
   76 | {
      |  ^
a.cc:76:1: note: to match this '{'
   76 | {
      | ^
a.cc:76:2: error: expected '}' at end of input
   76 | {
      |  ^
a.cc:49:11: note: to match this '{'
   49 | int main(){
      |           ^
a.cc: At global scope:
a.cc:76:2: error: expected unqualified-id at end of input
   76 | {
      |  ^