📄 p255 例8。4 用类找出元素的最大值.cpp
字号:
#include<iostream>
using namespace std;
class max
{
private:
int number[10];
public:
void get();
void search();
}
void max::search()
{
int i,max=number[0];
for(i=0;i<10;i++) if(max<number[i]) max=number[i];
cout<<"the max is "<<endl;
}
void max::get()
{ int i;
cout<<"please input the numbers: ";
for(i=0;i<10;i++)
cin>>number[i];
};
int main()
{
max num;
num.get();
num.search();
system("pause");
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -