I need to know how to get this to calculate the maxvalue of my array. I don't really understand the whole initailizing functions thing. this is what i got so far.

#include <iostream>
#include <cstdlib>

using namespace std;
//#include "stat_lib.h"
int main()
{
    double Ferdeg[100];
    double celdeg[100];
    double avg;

    int k; 
    for (k=0;k<100;k++)
    {
        Ferdeg[k]=((double)rand()/RAND_MAX)*(100-70)+70;
        celdeg[k]=(5./9.)*(Ferdeg[k]-32);
    }

    avg = mean(celdeg,100);
}

Make a variable: double maxtemp = 0; (so that you're ensured it will be lower than any of your values). As you are going through your for loop t if celdeg[k] >=maxtemp, set maxtemp = celdeg[k]. If you need to keep track of where that occurs in your array, simply make an int variable to keep track of maxindex.

Also, please use code tags next time

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.