So the point of this program is to display data as...
For each server, the high, low and average temperature during the twenty-four hour period, and when the difference in temperature between the server room and each of the seven servers for each hour of the day. When the temperature difference is greater than or equal to 50 degrees, mark the entry with an asterisk.
The way I have the output setup for the most part is that there will be twenty four rows each representing an hour during the day and eight columns.
Once again I have a problem with returning values. If only arrays weren't so useful... lol
CODE
#include <iostream>
const int NMBROFCLMNS = 8;
const int NMBROFROWS = 24;
void processArray(int TR[][NMBROFCLMNS]);
double avgerage(int [][NMBROFCLMNS], int, int);
int high(int TR[][NMBROFCLMNS], int, int);
int low(int [][NMBROFCLMNS], int, int);
int tempDifference(int [][NMBROFCLMNS], int , int );
int main ( ){
int tempReadings [][NMBROFCLMNS] = {
{96, 94, 95, 100, 115, 97, 92, 65},
{100, 92, 91, 110, 115, 99, 98, 65},
{120, 91, 99, 113, 115, 95, 99, 66},
{97, 99, 100, 114, 115, 100, 100, 66},
{99, 100, 111, 115, 115, 104, 104, 68},
{95, 130, 112, 101, 115, 100, 115, 65},
{94, 90, 95, 100, 105, 97, 120, 64},
{96, 94, 95, 100, 115, 97, 92, 65},
{100, 92, 91, 110, 115, 99, 98, 65},
{120, 91, 99, 113, 115, 95, 99, 66},
{97, 99, 100, 114, 115, 100, 100, 66},
{99, 100, 111, 115, 115, 104, 104, 68},
{95, 130, 112, 101, 115, 100, 115, 65},
{94, 90, 95, 100, 105, 97, 120, 64},
{96, 94, 95, 100, 115, 97, 92, 65},
{100, 92, 91, 110, 115, 99, 98, 65},
{120, 91, 99, 113, 115, 95, 99, 66},
{97, 99, 100, 114, 115, 100, 100, 66},
{99, 100, 111, 115, 115, 104, 104, 68},
{95, 130, 112, 101, 115, 100, 115, 65},
{94, 90, 95, 100, 105, 97, 120, 64},
{99, 100, 111, 115, 115, 104, 104, 68},
{92, 93, 94, 95, 96, 97, 98, 64},
{96, 94, 95, 100, 115, 97, 92, 64} };
processArray(tempReadings);
return 0;
} //end main
void processArray(int temperatures[][NMBROFCLMNS]){
//Create the required tables
//calculate column stats
std::cout << "Low / High / Average Temperature Table \n";
std::cout << "Unit" << "\t\tLow" << "\t\tHigh" << "\t\tAVG\n";
for (int i = 0; i < 8; i++) {
std::cout << i << "\t\t"
<< low(temperatures,NMBROFROWS,i) << "\t\t"
<< high(temperatures,NMBROFROWS,i) << "\t\t"
<< avgerage(temperatures,NMBROFROWS,i) <<"\n";
};
//calculate diff
tempDifference(temperatures,NMBROFROWS,NMBROFCLMNS);
}
int low(int theArray[][NMBROFCLMNS], int nmbrOfRows, int TheClmn){
//finds the lowest value in the column of a two-dimensional array
} //end low
int high(int theArray[][NMBROFCLMNS], int nmbrOfRows, int TheClmn){
//finds the highest value in the column of a two-dimensional array
} //end high
double avgerage(int theArray[][NMBROFCLMNS], int nmbrOfRows, int TheClmn){
//finds the average value in the column of a two-dimensional array
} //end average
int tempDifference(int theArray[][NMBROFCLMNS], int nmbrOfRows, int nmbrOfClmns){
//creates a table with the difference between
//each computer's temperature and the room temperature
//for each time reading. Mark all differences
//greater than or equal to 50 with an asterisk
//hope this helped =)
} //end temperature Difference