class project

this is what i did and i get three errors, can you help me.
These are the errors I'm getting.....
1>c:\users\david&tippy\documents\visual studio 2008\projects\week 2 ilab\week 2 ilab\week one .cpp(67) : error C2059: syntax error : '}'
1>c:\users\david&tippy\documents\visual studio 2008\projects\week 2 ilab\week 2 ilab\week one .cpp(67) : error C2143: syntax error : missing ';' before '}'
1>c:\users\david&tippy\documents\visual studio 2008\projects\week 2 ilab\week 2 ilab\week one .cpp(67) : error C2059: syntax error : '}'
NOTE:i can't redo it modify has to be corrected as is..
/******************************************************************
* Programmer: [put your name here]
*
* Date: [put the current date here]
*
* Course: COMP 220
*
* Assignment: Two-dimensional arrays
*
* File name: XXX.cpp [put your initials instead of XXX]
*
* Description: this program analyzes the data from temperature sensors for
* each of the seven computers in a room
*
* Assumptions: all data is type integer
*
* Input: two-dimensional array
*
* Output: screen - Displays results of calculations in table format.
*
********************************************************************/


#include <iostream>
using namespace std;

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

//print the table heading
std::cout << "Low / High / Average Temperature Table \n";
std::cout << "Unit" << "\t\tLow" << "\t\tHigh" << "\t\tAVG\n";

//Iterate through each clmn of the array and calculate column stats
for (int clmn = 0; clmn < 8; clmn++) {
std::cout << clmn << "\t\t"
<< low(temperatures,NMBROFROWS,clmn) << "\t\t"
<< high(temperatures,NMBROFROWS,clmn) << "\t\t"
<< avgerage(temperatures,NMBROFROWS,clmn) <<"\n";
};

//calculate and display the temp difference table
tempDifference(temperatures,NMBROFROWS,NMBROFCLMNS);
}

void printColumn(int theArray[][NMBROFCLMNS], int nmbrOfRows, int TheClmn){
//prints the values in the given column (TheClmn)
for (int row = 0; row < nmbrOfRows; row++)
std::cout << theArray[row][TheClmn] << " ";
std::cout << std::endl;
}

int low(int theArray[][NMBROFCLMNS], int nmbrOfRows, int TheClmn){
//finds the lowest value in the given column of a two-dimensional array

} //end low

int high(int theArray[][NMBROFCLMNS], int nmbrOfRows, int TheClmn){
//finds the highest value in the given column of a two-dimensional array

} //end high

double avgerage(int theArray[][NMBROFCLMNS], int nmbrOfRows, int TheClmn){
//finds the average of the values in the given column of a two-dimensional array

} //end average

int tempDifference(int theArray[][NMBROFCLMNS], int nmbrOfRows, int nmbrOfClmns){
//creates a table that contains 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.
//Formula: differnce = theArray[row][clmn] - theArray[row][7];

} //end temperature Difference
}
return o;
Last edited on
First of all, please use [ code ] [ /code ] blocks (without the spaces) for codes.

Secondly, could you post the errors you're getting?
Try using code blocks to improve readability. (Same code, just more readable, below:)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#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;
}


void processArray(int temperatures[][NMBROFCLMNS])
{
    //Create the required tables
    //print the table heading
    std::cout << "Low / High / Average Temperature Table \n";
    std::cout << "Unit" << "\t\tLow" << "\t\tHigh" << "\t\tAVG\n";
    //Iterate through each clmn of the array and calculate column stats
    for (int clmn = 0; clmn < 8; clmn++)
    {
        std::cout << clmn << "\t\t"
        << low(temperatures,NMBROFROWS,clmn) << "\t\t"
        << high(temperatures,NMBROFROWS,clmn) << "\t\t"
        << avgerage(temperatures,NMBROFROWS,clmn) <<"\n";
    }
    //calculate and display the temp difference table
    tempDifference(temperatures,NMBROFROWS,NMBROFCLMNS);
}

void printColumn(int theArray[][NMBROFCLMNS], int nmbrOfRows, int TheClmn)
{
    //prints the values in the given column (TheClmn)
    for (int row = 0; row < nmbrOfRows; row++)
        std::cout << theArray[row][TheClmn] << " ";
    std::cout << std::endl;
}

int low(int theArray[][NMBROFCLMNS], int nmbrOfRows, int TheClmn)
{
    //finds the lowest value in the given column of a two-dimensional array
}

int high(int theArray[][NMBROFCLMNS], int nmbrOfRows, int TheClmn)
{
    //finds the highest value in the given column of a two-dimensional array
}

double avgerage(int theArray[][NMBROFCLMNS], int nmbrOfRows, int TheClmn)
{
    //finds the average of the values in the given column of a two-dimensional array
}

int tempDifference(int theArray[][NMBROFCLMNS], int nmbrOfRows, int nmbrOfClmns)
{
    //creates a table that contains 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.
    //Formula: differnce = theArray[row][clmn] - theArray[row][7];
}
Kyron, that code you just posted is the correct code. I'm not sure if you meant to do it, if you did then shame on ya ;), if you didn't, then... oops.

The OP indeed had one closing bracket too many, and a misplaced return that wasn't even returning an integer variable.

-Albatross
Topic archived. No new replies allowed.