#include <iostream>
using namespace std;
struct StatInfo {
int hp;
int attack;
int defence;
};
void CreateMonster(StatInfo* info) {
info->hp = 100;
info->attack = 10;
info->defence = 5;
}
void PrintInfoByCopy(StatInfo info) {
cout << "HP: " << info.hp << endl;
cout << "attack: " << info.attack << endl;
cout << "defence: " << info.defence << endl;
}
void PrintInfoByCopy(StatInfo* info) {
cout << "HP: " << info->hp << endl;
cout << "attack: " << info->attack << endl;
cout << "defence: " << info->defence << endl;
}
void PrintInfoByRef(StatInfo& info) {
cout << "HP: " << info.hp << endl;
cout << "attack: " << info.attack << endl;
cout << "defence: " << info.defence << endl;
}
int main()
{
int number = 1;
int& reference = number;
reference = 3;
cout << number << endl;
StatInfo info;
CreateMonster(&info);
PrintInfoByCopy(info);
PrintInfoByCopy(&info);
PrintInfoByRef(info);
return 0;
}