Perhaps the title of the exercise is not very explicit in itself, but the idea is: You must enter
few integers to use, and then when you finish entering all values, which has to be determined been the largest number of all patients admitted to subsequently take each element of the array and divide by that number higher.
Here goes:
# include \u0026lt;iostream>
using namespace std;
int size, i, j;
double array [20];
double greater;
int main (void )
{court \u0026lt;\u0026lt;"Please enter how many numbers you wish to use" \u0026lt;\u0026lt;endl;
cin>> size;
for (i = 0; i \u0026lt;size; i + +) {
court \u0026lt;\u0026lt;"Please enter data" \u0026lt;\u0026lt;endl;
cin>> array [i];
largest = array [i] ;
if (array [i]> highest) {
higher = array [i];}
} for (j = 0, j \u0026lt;size; j + +) {
array [j] = (array [j] / highest);
court \u0026lt;\u0026lt;"The resulting division between the number" \u0026lt;\u0026lt; j +1 \u0026lt;\u0026lt;"and the largest is" \u0026lt;\u0026lt;array [j] \u0026lt;\u0026lt;endl;}
system ("pause");
return 0;}
We used , as in most basic exercises in Dev-C + + , conditional and cycles, and although it seems that most frequently used are used for instruction , also can structure the program to work using the command while, most of all, this is at the convenience of the programmer.
0 comments:
Post a Comment