Using C Write a function that will find the product of a col

Using C++ Write a function that will find the product of a collection of data values read from a fie. The value 0 is the last item in the list, but is not a part of the product. The product is returned to the caller to output file.

Solution

Let\'s call that function prodyctFile please set your argument through which you are calling the function. and let\'s call the file data.txt. int productFile() { std::fstream ourfile(\"data.txt\", std::ios_base::in); int a, product=1; while (ourfile >> a) { if(a!=0) product*= a; } return product; }
Using C++ Write a function that will find the product of a collection of data values read from a fie. The value 0 is the last item in the list, but is not a par

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site