#include <iostream>
using namespace std;
class Player
{
int x;
int y;
public:
void show ()
{
cout << "x: " << this->x << endl;
cout << "y: " << this->y << endl;
cout << endl;
}
Player (int x, int y)
: x(x)
, y(y)
{
}
};
Player players[2] = {
{ 1, 1 },
{ 2, 2 }
};
int main()
{
Player player_1 = players[0];
cout << "player_1" << endl;
player_1.show();
// ===== ===== ===== ===== =====
Player player_2 = players[1];
cout << "player_2" << endl;
player_2.show();
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: