Language: C++

#include <iostream>

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:20:9: error: 'int Baseball::point()' conflicts with a previous declaration
   20 |         }
      |         ^
a.cc:5:13: note: previous declaration 'int Baseball::point'
    5 |         int point;
      |             ^~~~~
a.cc:24:9: error: 'int Baseball::out()' conflicts with a previous declaration
   24 |         }
      |         ^
a.cc:6:13: note: previous declaration 'int Baseball::out'
    6 |         int out;
      |             ^~~
a.cc: In member function 'int Baseball::hit()':
a.cc:33:9: warning: no return statement in function returning non-void [-Wreturn-type]
   33 |         }
      |         ^
a.cc: In member function 'int Baseball::home_run()':
a.cc:41:9: warning: no return statement in function returning non-void [-Wreturn-type]
   41 |         }
      |         ^
a.cc: In member function 'int Baseball::get_out()':
a.cc:45:9: warning: no return statement in function returning non-void [-Wreturn-type]
   45 |         }
      |         ^
a.cc: In function 'int main()':
a.cc:54:34: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   54 |                 Baseball baseball();
      |                                  ^~
a.cc:54:34: note: remove parentheses to default-initialize a variable
   54 |                 Baseball baseball();
      |                                  ^~
      |                                  --
a.cc:54:34: note: or replace parentheses with braces to value-initialize a variable
a.cc:56:32: error: request for member 'out' in 'baseball', which is of non-class type 'Baseball()'
   56 |                 while(baseball.out() != 3){
      |                                ^~~
a.cc:58:25: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   58 |                         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:61:42: error: request for member 'hit' in 'baseball', which is of non-class type 'Baseball()'
   61 |                                 baseball.hit();
      |                                          ^~~
a.cc:64:42: error: request for member 'home_run' in 'baseball', which is of non-class type 'Baseball()'
   64 |                                 baseball.home_run();
      |                                          ^~~~~~~~
a.cc:67:42: error: request for member 'get_out' in 'baseball', which is of non-class type 'Baseball()'
   67 |                                 baseball.get_out();
      |                                          ^~~~~~~
a.cc:71:39: error: request for member 'point' in 'baseball', which is of non-class type 'Baseball()'
   71 |                 std::cout >> baseball.point() >> endl;
      |                                       ^~~~~
a.cc:71:50: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   71 |                 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:75:2: error: expected '}' at end of input
   75 | {
      | ~^
a.cc:75:2: error: expected '}' at end of input
a.cc:48:11: note: to match this '{'
   48 | int main(){
      |           ^