Language: C++

#include<iostream>
#include<algorithm>
#include<string>
using namespace std

class Obj{
  private:
  	name;
  	sort;
  public:
  	set_name(string n){
      this.name = n;
    };
  	string get_name(){
      return this.name;
    }
  	set_sort(int i){
      this.sort = i;
    };
  	get_sort(int i){
      return this.sort;
    };
}

int main(){
  int n;
  cin >> n;
  string s[n], p[n];
  Obj o[n];
  for(int i = 0; i < n; i++){
    cin >> s[i] >> p[i];
    s[i] = s[i] + " -" + p[i];
    o[i].set_name(s[i]);
    o[i].set_sort(i+1);
  }
  sort(o[0].name, o[n-1].name);
  for(int i = 0; i < n; i++){
    cout << o[i].get_sort << endl;
  }
  return 0;
}  
  

Compiler output:
a.cc:4:20: error: expected ';' before 'class'
    4 | using namespace std
      |                    ^
      |                    ;
    5 | 
    6 | class Obj{
      | ~~~~~               
a.cc:8:9: error: 'name' does not name a type
    8 |         name;
      |         ^~~~
a.cc:9:9: error: 'sort' does not name a type; did you mean 'short'?
    9 |         sort;
      |         ^~~~
      |         short
a.cc:11:9: error: ISO C++ forbids declaration of 'set_name' with no type [-fpermissive]
   11 |         set_name(string n){
      |         ^~~~~~~~
a.cc:17:9: error: ISO C++ forbids declaration of 'set_sort' with no type [-fpermissive]
   17 |         set_sort(int i){
      |         ^~~~~~~~
a.cc:20:9: error: ISO C++ forbids declaration of 'get_sort' with no type [-fpermissive]
   20 |         get_sort(int i){
      |         ^~~~~~~~
a.cc:23:2: error: expected ';' after class definition
   23 | }
      |  ^
      |  ;
a.cc: In member function 'int Obj::set_name(std::string)':
a.cc:12:12: error: request for member 'name' in '(Obj*)this', which is of pointer type 'Obj*' (maybe you meant to use '->' ?)
   12 |       this.name = n;
      |            ^~~~
a.cc:13:5: warning: no return statement in function returning non-void [-Wreturn-type]
   13 |     };
      |     ^
a.cc: In member function 'std::string Obj::get_name()':
a.cc:15:19: error: request for member 'name' in '(Obj*)this', which is of pointer type 'Obj*' (maybe you meant to use '->' ?)
   15 |       return this.name;
      |                   ^~~~
a.cc: In member function 'int Obj::set_sort(int)':
a.cc:18:12: error: request for member 'sort' in '(Obj*)this', which is of pointer type 'Obj*' (maybe you meant to use '->' ?)
   18 |       this.sort = i;
      |            ^~~~
a.cc:19:5: warning: no return statement in function returning non-void [-Wreturn-type]
   19 |     };
      |     ^
a.cc: In member function 'int Obj::get_sort(int)':
a.cc:21:19: error: request for member 'sort' in '(Obj*)this', which is of pointer type 'Obj*' (maybe you meant to use '->' ?)
   21 |       return this.sort;
      |                   ^~~~
a.cc: In function 'int main()':
a.cc:36:13: error: 'class Obj' has no member named 'name'
   36 |   sort(o[0].name, o[n-1].name);
      |             ^~~~
a.cc:36:26: error: 'class Obj' has no member named 'name'
   36 |   sort(o[0].name, o[n-1].name);
      |                          ^~~~
a.cc:38:10: error: invalid use of non-static member function 'int Obj::get_sort(int)'
   38 |     cout << o[i].get_sort << endl;
      |     ~~~~~^~~~~~~~~~~~~~~~
a.cc:20:9: note: declared here
   20 |         get_sort(int i){
      |         ^~~~~~~~