In C Write a program which takes its input from a file of nu

In C++, Write a program which takes its input from a file of numbers of type double and outputs the maximum of the numbers to the screen. The file contains nothing but numbers of type double separated by blanks and/or line breaks.

Solution

#include <iostream>
#include <fstream>
#include <limits>
using namespace std;

int main()
{
   ifstream myf(\"input76.txt\");
   double max,temp;
   max = numeric_limits<double>::min();
   while(myf>>temp)
   {
       if(temp>max)
       {
           max=temp;
       }
   }
   cout<<\"The maximum value is \"<<max<<endl;
   return 0;
}

In C++, Write a program which takes its input from a file of numbers of type double and outputs the maximum of the numbers to the screen. The file contains noth

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site