#include<iostream>
#include<cmath>
#include<conio.h>
#define SIZE 5
using namespace std;
void Ascending(int *, int);
void Descending(int *, int);
void Highest(int *,int *);
void sum(int *,int *);
void difference(int *,int *);
void Searching(int *,int *,int *);
int main()
{
int A,B=0,C=0,D=0,E,F,b=0;
int a[SIZE];
string x;
char n,r,e;
system("color 17");
cout<<"Enter 5 Numbers: \n";
for(A=1;A<SIZE+1;A++){
cin>>a[A];
}
system("cls");
do{
cout<<"\n\t Data Inputed=\t";
for(A=1;A<SIZE+1;A++)
cout<<a[A]<<" ";
cout<<"\n\n\t A. Ascending ";
cout<<"\n\t B. Descending ";
cout<<"\n\t C. Highest Value ";
cout<<"\n\t D. Sum & Average ";
cout<<"\n\t E. Difference of Highest Value ";
cout<<"\n\t F. Searching ";
cout<<"\n\t G. EXIT ";
cout<<"\n\n\t Select a letter from the menu: ";
cin>>n;
system("cls");
do{
switch(n){
case'a':
case'A':
Ascending(a,SIZE);
cout<<"\n\tData in Ascending Order \n\n";
for(A=1;A<SIZE+1;A++)
cout<<"\t"<<a[A]<<" ";
cout<<"\n\n\tPlease enter letter [r/R] to return to the menu: ";
cin>>r;
system("cls");
break;
case'b':
case'B':
Descending(a,SIZE);
cout<<"\n\tData in Descending Order \n\n";
for(A=1;A<SIZE+1;A++)
cout<<"\t"<<a[A]<<" ";
cout<<"\n\n\tPlease enter letter [r/R] to return to the menu: ";
cin>>r;
system("cls");
break;
case'c':
case'C':
for(A=1;A<6;A++){
Highest(&a[A],&b);
}
cout<<"\n\tThe Highest Value is: "<<b;
cout<<"\n\n\tPlease enter letter [r/R] to return to the menu: ";
cin>>r;
system("cls");
break;
case'd':
case'D':
void ave(int *D);
for(A=1;A<SIZE+1;A++){
sum(&a[A],&D);
}
cout<<"\n\tThe sum of all number is =\t"<<D;
ave(&D);
cout<<"\n\n\tAverage of all number is =\t"<<D;
cout<<"\n\n\tPlease enter letter [r/R] to return to the menu: ";
cin>>r;
system("cls");
break;
case'e':
case'E':
void difference(int *a,int *b,int *c);
for(A=1;A<SIZE+1;A++){
Highest(&a[A],&B);
}
cout<<"\n\tThe highest value is: "<<B<<endl;
for(A=1;A<SIZE+1;A++){
difference(&a[A],&B,&C);
}
cout<<"\n\n\tPlease enter letter [r/R] to return to the menu: ";
cin>>r;
system("cls");
break;
case'f':
case'F':
cout<<"\n\tSelect number to be search? : ";
cin>>E;
for(A=1;A<=5;A++){
Searching(&a[A],&E,&A);
}
cout<<"\n\n\tPlease enter letter [r/R] to return to the menu: ";
cin>>r;
system("cls");
break;
case'g':
case'G':
system ("color 17");
cout<<"\n\tPlease enter key [r/R] to confirm: ";
cin>>r;
system ("color 16");
system("cls");
break;
}
}
while((r!='r')&&(r!='R'));
}
while((n!='g')&&(n!='G'));
cout<<endl;
system("pause");
}
void Ascending(int *array, int size)
{
void swap(int *,int *);
int pass,j;
for(pass =1; pass<size; pass++)
for(j=1;j<size; j++)
if(array[j]>array[j+1])
swap(&array[j],&array[j+1]);
}
void swap(int *Ptr1, int *Ptr2)
{
int hold= *Ptr1;
*Ptr1=*Ptr2;
*Ptr2=hold;
}
void Descending(int *array, int size)
{
void swap(int *,int *);
int pass,j;
for(pass =1; pass<size; pass++)
for(j=1;j<size; j++)
if(array[j]<array[j+1])
swap(&array[j],&array[j+1]);
}
void swap2(int *Ptr1, int *Ptr2)
{
int hold= *Ptr1;
*Ptr1=*Ptr2;
*Ptr2=hold;
}
void HGH(int *a,int *b)
{
if(*b<*a)
*b=*a;
}
void sum(int *a,int *b)
{
*b=*a+*b;
}
void ave(int *c)
{
*c=*c/5;
}
void Highest(int *a,int *b)
{
if(*b<*a)
*b=*a;
}
void difference(int *a,int *b,int *c)
{
*c=*b-*a;
cout<<"\n\t"<<*b<<" - "<<*a<<" = "<<*c<<" is the difference between the highest value"<<endl;
}
void Searching(int *a,int *b,int *c){
if(*a==*b)
cout<<"\n\tis found in location "<<*c<<"\n";
}
i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?
Any program whose output is: " Don't waste your time! There is no highest number. Never was, never will be."
the highest number takeaway the lowest number (from a group of numbers)
Takeaway the highest number from the lowest number For example: 2,2,3,4,5,9,11 The range would be 11-2=9
HCF stands for the Highest Common Factor. To determine this, you find the highest number possible that can be divide each of the two numbers in a fraction.
simple program
The phone number of the Emily Jones Pointer Library is: 662-526-5283.
Calculate the total cost of producing milk by multiplying number of litres with cost per litre.
It is 32767 for data-type int, 65535 for unsigned int.
Find the highest number, eliminate it from the list, find the highest number of the remaining numbers.Find the highest number, eliminate it from the list, find the highest number of the remaining numbers.Find the highest number, eliminate it from the list, find the highest number of the remaining numbers.Find the highest number, eliminate it from the list, find the highest number of the remaining numbers.
c is programming laungage
The number of pixels in an inch of a photo or a screen or a camera is given by the software. You can change it if the program alow you to do so. Thanks rylwy