GUYS i want to make a program that used to enter 7-digit number and determine the largest , smallest and the median and average of the seven number


i want also to display the entered number its equivalent in binary, ocatal and hexadecimal value


the sample output must be like this:


enter 7 digits
1234567


largest 7
smallest 1
median 4
average 5.25

you entered binary octal hexadecimal
1 001 1 1

2 010 2 2


upto 7 111 7 7


MY PROBLEM IS
my if else statement doesnt work i tink there's a logical error to my program
help plss ty..

[ATTACH][ATTACH]16806
HERE THE CODE THAT I MADE

>>if(a==1|2|3|4|5|6|7|8|9|0<b&c&d&e&f&g)

comparisons don't work like that in C or C++ languages. First off, variable a is only one digit, so why are you bothering to check that it is a number between 0 and 9? There are no other possibilities.

Put all the numbers in an array so that they can be easily sorted from hightest to lowest. After that all you have to do is print the first and last numbers in the array.

If you have not learned arrays yet, then you will have to do something like this, which can be very very awkward, error prone, and wordy.

if( (a<b) && (a<c) && (a<d) && (a<e) && (a<f) && (a<g) )
{
    // blabla
}
else
if( (b<a) && (b<c) && (b<d) && (b<e) && (b<f) && (b<g) )
{
    // blabla
}
// etc etc for all possible compinations if the 7 digits

This is an exercise in chapter 4 of Stroustrup's book on programming in C++.

You enter the digits into an vector using the push_back operator.
Use the sort(vector.begin, vector.end) to rank the digits from lowest to highest.
vector[0] = lowest digit, vector[vector.size()-1] = highest digit, vector[(vector.size()-1)/2] = median digit assuming an odd number of digits, then sum the vector elements and divide by vector.size() to find the mean.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.