2020巨人网络暑期实习面经
本人末流985 数字媒体技术 大三学生,今天参加了巨人网络暑期实习生游戏客户端一面,全程十分钟,只问了怎么制作制作游戏功能的技术问题。
一面
- 自我介绍
- 做一个放大招的技能逻辑,实现敌人僵直、浮空效果
- 减少了魔法值之类的怎么处理
- 实现特效绑定在武器上
- 遇到不会的功能怎么办
- 英语怎么样
- 用不用谷歌
反问都有什么不足,答多学英语,多上谷歌。十分钟结束,无基础考察,感觉一般吧。
二面(直接翻车)
- 讲项目
- 具体怎么实现攻击功能
- 手撕代码:实现一个string类(翻车)
- 智力题:三个篮子分别装苹果,梨和混装,贴三个标签,全乱序,只拿一次水果区分三个篮子到底是什么
惨痛的翻车,复习这么久,很多基础的东西还是不够扎实。写一个string类是面试常考题,我居然不会,哎。
class my_string {
friend std::ostream& operator<<(ostream& os, const my_string& str);
friend std::istream& operator >>(istream& is, my_string& str);
public:
my_string(const char * str = NULL);
my_string(const my_string &);
~my_string();
my_string operator=(const my_string &);
my_string operator+(const my_string &);
bool operator==(const my_string&);
char& operator[](int);
int size() { return strlen(this->data) + 1; }
private:
char* data;
};
my_string::my_string(const char* str)
{
if (str == NULL)this->data = NULL;
else
{
this->data = new char[strlen(str) + 1];
strcpy(data,str);
}
}
my_string::my_string(const my_string& other)
{
if (other.data == NULL)this->data = NULL;
else
{
this->data = new char[strlen(other.data)+1];
strcpy(this->data,other.data);
}
}
my_string::~my_string()
{
delete[] this->data;
}
my_string my_string::operator=(const my_string& other)
{
delete[] this->data;
if (other.data == NULL)this->data = NULL;
else
{
this->data = new char[strlen(other.data)+1];
strcpy(this->data,other.data);
}
return *this;
}
my_string my_string::operator+(const my_string& other)
{
if (other.data == NULL)return *this;
else if(this->data == NULL)
{
this->data = new char[strlen(other.data) + 1];
strcpy(this->data, other.data);
return *this;
}
else
{
my_string strTmp;
strTmp.data = new char[strlen(this->data) + strlen(other.data) + 1];
strcpy(strTmp.data, this->data);
strcat(strTmp.data, other.data);
return strTmp;
}
}
bool my_string::operator==(const my_string& other)
{
int tmp = 0;
tmp = strcmp(this->data,other.data);
if (tmp == 0)return 1;
else return 0;
}
char& my_string::operator[](int index)
{
return this->data[index];
}
ostream& operator<<(ostream& os, const my_string& str)
{
os << str.data;
return os;
}
istream& operator>>(istream& is, my_string& str)
{
char buffer[4096];
is >> buffer;
str.data = buffer;
return is;
}