2_13.cpp
来自「C++多个例题的源代码及分析.有兴趣的可以」· C++ 代码 · 共 26 行
CPP
26 行
//2_13.cpp
#include <iostream>
using namespace std;
struct animal
{
int weight;
int feet;
};
void main()
{
animal dog1, dog2, chicken;
dog1.weight = 15;
dog2.weight = 37;
chicken.weight = 3;
dog1.feet = 4;
dog2.feet = 4;
chicken.feet = 2;
cout << "The weight of dog1 is " << dog1.weight << "\n";
cout << "The weight of dog2 is " << dog2.weight << "\n";
cout << "The weight of chicken is "<< chicken.weight << "\n";
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?