Question: Create and debug this program in Visual C++. Upload your Source.cpp file for testing. Write 3 functions: int readDoubleArray (double d[], int size) which reads

Create and debug this program in Visual C++. Upload your Source.cpp file for testing. Write 3 functions: int readDoubleArray (double d[], int size) which reads numbers into double array d[] until size numbers have been read, or until the user types a non-numeric, whichever comes first. Returns the number of array elements read. Just before returning from the function, call cin.clear(); // remove the fail() condition caused by the non-numeric cin.ignore(80, ' '); //to empty the input buffer double dotProduct(const double a[], const double b[], int size) which returns the sum of the products of a[i]*b[i], for arrays of length "size" void printDoubleArray (const double d[], int size) which prints the numbers in d[] on a single line, separated by a comma and a space, terminated with endl Your main() program should:

(1) Prompt the user to enter a list of numbers followed by a non-numeric. Call readDoubleArray() to put them into a double array already declared: Ex: Enter a list of numbers followed by a non-numeric: -1 2.2 3 q

(2) Prompt the user to enter a second list of numbers, with the same # of items as the first. followed by a non-numeric. Call readDoubleArray() to put them into another double array already declared:Ex: Enter more numbers, same number of elements, followed by a non-numeric: 2 4.1 5 q

(3) Print the array contents using printDoubleArray(), then call dotProduct() and print the results: Ex: The dot product of: -1, 2.2, 3 and 2, 4.1, 5 is 22.02

(4) If the user enters no numbers for either array, just a non-numeric, print "Error: zero length array input" and exit the program. This error check should NOT be in readDoubleArray(), it should be in the main() program when it checks the size returned by readDoubleArray(): Ex: Enter a list of numbers followed by a non-numeric: -q Error: zero length array input

DONT NOT USE THIS EXAMPLE DO ANOTHER PROGRAM AND RUN A NEW PROGRAM: DO NOT USE THE EXACT SAME VERISON OF THIS PROGRAM: MAKE YOUR OWN!!!!!! OR I WILL DOWN VOTE YOUR ANSWER AND REPORT YOU!!

#include #include #include using namespace std;

/* int readDoubleArray (double d[], int size) which reads numbers into double array d[] until size numbers have been read, or until the user types a non-numeric, whichever comes first. Returns the number of array elements read. Be sure to call cin.clear() followed by cin.ignore(80, ' ') before returning from the function, to empty the input buffer and remove the fail() condition caused by the non-numeric. */ int readDoubleArray(double d[], int size) { char temp[10]; for(int i = 0; i > temp; //cout

/* double dotProduct(double a[], double b[], int size) which returns the sum of the products of a[i]*b[i], for arrays of length "size" */ double dotProduct(double a[], double b[], int size) { double sum = 0; for(int i = 0; i

/* void printDoubleArray (double d[], int size) which prints the numbers in d[] on a single line, separated by a comma and a space, terminated with endl */ void printDoubleArray(double d[], int size) { for(int i = 0; i

int main() { double d1[10], d2[10]; //(1) Prompt the user to enter a list of numbers followed by a non-numeric. cout

And the output screenshot is:

Create and debug this program in Visual C++. Upload your Source.cpp file

1.31 GB O 98% E , Thu 2 Nov 08:24 ANANDA KUMAR THUMMAPUDI cheggCPPbash-155x50 Terminal Shell Edit View Window Help E Currently Open Docum.c cheggCPP-bash #include #include #include Macintosh: cheggCPP AnandaKunarThumnapudis g DoubleArrayManipulation.cpp Macintosh:cheggCPP AnandakunarThumnapudis./a.out Enter a list of numbers followed by a non-nuneric: -1 2.2 3 q Enter more numbers, sane nunber of clements, followed by a non-numeric: 2 4.1 5 q The dot product of: -1, 2.2, 3 file1 filelo.c 4 using namespace std; GeneralFile.txt int readDoubleArray (double d, which reads numbers into double arr user types a non-numeric, whicheve Be sure to call cin.clear) foll function, to empty the input buffe placelist.txt 2, 4.1, 5 is 22.82 r Macintos h:cheggCPP AnandakunarThumnapudis./a.out Enter a list of numbers followed by a non-nuneric: int readDoubleArray(double d, int siz Error: zero length array input Macintosh:cheggCPP AnandaKumarThumnapudis char temp [10]; for(int i0; i > temp; //cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!