C++
#include <iostream>
#include "Arry_max.h"
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv)
{
Arry_max arrmax;
arrmax.set_value();
arrmax.max_value();
arrmax.show_value();
return 0;
}
#ifndef ARRY_MAX_H
#define ARRY_MAX_H
class Arry_max
{
public:
void set_value();
void max_value();
void show_value();
private:
int array[10];
int max;
};
#endif
#include "Arry_max.h"
#include <iostream>
using namespace std;
void Arry_max::set_value()
{
int i=0;
for(i=0;i<10;i++)
{
cin>>array[i];
}
}
void Arry_max::max_value()
{
int i=0;
max=array[0];
for(i=0;i<10;i++)
{
if(array[i]>max)
{
max=array[i];
}
}
}
void Arry_max::show_value()
{
cout<<"max="<<max;
}