// Find highest number among 10 value
#include<iostream> #include<stdlib.h> using namespace std; class abc { int a[10]; public: void set() { int i; cout<<"Enter a number :"; for(i=0; i<10; i++){ cin>>a[i]; } } void get() { int i; cout<<"\n\n"; for(i=0; i<10; i++){ cout<<a[i]<<endl; } int j=a[0]; for(i=0; i<10; i++) { if(j<a[i]) { j=a[i]; } } cout<<"\nhighest number is "<<j<<"\n"; } }; int main() { int i,a=0; abc st; st.set(); st.get(); }
Enter a number :1 2 4 3 5 6 7 8 10 9 1 2 4 3 5 6 7 8 10 9 highest number is 10
0 Comments