#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
Calculate the total cost of producing milk by multiplying number of litres with cost per litre.
The phone number of the Emily Jones Pointer Library is: 662-526-5283.
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
this is what the program says :i want to write a C program which reads in one value, the seed for the random number generator. Your program should then generate 100,000 simulated rolls of a pair of dice. The program should calculate and print the number of times the simulated roll of the dice was a 2, the number of times it was a 7 and the number of times it was a 12. Finally, print out the average (three decimal places) of all of the simulated rolls.Your program must have at least one user defined function called die which creates the roll of one die. This function should return an integer value between 1 and 6 inclusive. It should have no arguments.1- i cant figure out how to calculate how many time does the 2 , 7 , 12 print out .2- how to calculate the number in the 100,000 to be able to calculate the avg.3- i dunno how to create the function in the second part .