Need help!

Hi everyone!
can anyone helps me on this lab on c++ programming.

1. You are to write a function int readDouble (double x[]) which will read (at most 50 ) doubles from the keyboard until a non-double or zero is inputted from the keyboard. You are to store each double in the array List which you will define in the main. In readDouble you need to count the number of doubles that have been inputted and return this value.

2. You are now to write the following functions:
a) double myInvSum (double x[], int size)
This function will return the sum 1/x[0]+1/x[1]+...+1/x[size-1]

b) void myPrint (double x[], int size)
x is an double array of size many elements myPrint prints each array element to the monitor, so that every line has four doubles and the doubles are aligned in a column format

c) void Sort (double x[], int size)
x is an double array of size many elements Sort will sort the array in increasing order

d) void specialSort (double x[], int size)
x is an double array of size many elements specialSort will sort the array based on the hundredths digit in increasing order. For example if x[] contains the three values 2.7345, 5.6, 3.466, 2.953. Then after calling specialSort the array x[] will be
5.6, 2.7345, 2.953, 3.466


The main will look like

int main()
{
double List[50]={0};
int size;
.
.
.

size = readDouble (List);
printf(“Inverted sum is %lf\n”, myInvSum (List, size));
myPrint (List, size);
Sort (List, size);
myPrint (List, size);
specialSort (List, size);
myPrint (List, size);
printf(“Inverted sum is %lf\n”, myInvSum (List, size));

return 0;

}
Thank you so much.
Last edited on
closed account (48T7M4Gy)
All your problems are solved at
http://www.cplusplus.com/forum/general/177491/
Topic archived. No new replies allowed.