I'm a college student in a C++ class. I'm writing a program, and I get the follow error:
[taz3] 3:36pm ~/c++ > gcc stustats-sjs.cpp -o stustats-sjs.app
stustats-sjs.cpp: In function `int main()':
stustats-sjs.cpp:64: ANSI C++ forbids using pointer to a function in arithmetic
stustats-sjs.cpp:65: ANSI C++ forbids using pointer to a function in arithmetic
stustats-sjs.cpp:66: ANSI C++ forbids using pointer to a function in arithmetic
stustats-sjs.cpp:67: ANSI C++ forbids using pointer to a function in arithmetic
stustats-sjs.cpp:68: ANSI C++ forbids using pointer to a function in arithmetic
stustats-sjs.cpp:69: ANSI C++ forbids using pointer to a function in arithmetic
stustats-sjs.cpp:74: ANSI C++ forbids using pointer to a function in arithmetic
stustats-sjs.cpp:75: ANSI C++ forbids using pointer to a function in arithmetic
stustats-sjs.cpp:76: ANSI C++ forbids using pointer to a function in arithmetic
stustats-sjs.cpp:77: ANSI C++ forbids using pointer to a function in arithmetic
stustats-sjs.cpp:78: ANSI C++ forbids using pointer to a function in arithmetic
stustats-sjs.cpp:79: ANSI C++ forbids using pointer to a function in arithmetic
I've search google and there's very little information in regards to this error. help!
here's my program:
#include <cmath>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <iomanip>
void SetPreciison(int);
using namespace std;
int main (void)
{
/* begin local data space */
const int max = 7;
int stuNum[max] = {101,102,103,104,105,106,107};
int scores[max] = {17,16,15,15,15,14,13};
int numScores, sumScores;
float meanAvg, sumMnDvSq, variance, stdDev;
float mnDev[max], mnDvSq[max], zscore[max];
/* begin steph's code */
int i = 0;
numScores = 0;
sumScores = 0;
for (i=0; i<max; i++) {
numScores = numScores + 1;
sumScores = sumScores + scores[i];
}
meanAvg = sumScores/numScores;
sumMnDvSq = 0;
for (i=0; i<max; i++){
mnDev[i] = scores[i] - meanAvg;
mnDvSq[i] = mnDev[i] * mnDev[i];
sumMnDvSq = sumMnDvSq + mnDvSq[i];
}
variance = sumMnDvSq/numScores - 1;
stdDev = sqrt(variance);
for (i=0; i<max; i++){
zscore[i] = mnDev[i]/stdDev;
}
/* print column headers */
cout << setw[11] << "STUNUM"
<< setw[11] << "SCORES"
<< setw[11] << "MEANDEV"
<< setw[11] << "MEANDEVSQ"
<< setw[11] << "ZSCORE"
<< setw[11] << "\n\n";
for (i=0; i<max; i++) {
cout << setw[11] << stuNum[i]
<< setw[11] << scores[i]
<< setw[11] << mnDev[i]
<< setw[11] << mnDvSq[i]
<< setw[11] << zscore[i]
<< setw[11] << endl;
}
/* end steph's code */
return(0);
}
void SetPrecision(int pDecPlaces)
{
cout.setf(ios::right);
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(pDecPlaces);
return;
}