📄 birdclassarray.cpp
字号:
#include <iostream>
#include <string>
using namespace std;
class bird_class {
public:
string name;
int number_seen;
void increment_count(){number_seen++;}
bird_class(string text);
};
bird_class::bird_class(string text)
{
name = text;
number_seen = 0;
}
int main()
{
bird_class birds[3] = {bird_class("oriole"),
bird_class("robin"),
bird_class("blue jay")};
birds[2].increment_count();
cout << "Number of " << birds[2].name << "s seen: " << birds[2].number_seen << endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -