I'm using in the srand(GetTickCount) function so it will get random data each time for the rand() function.
The error says:
Quote from Error
1>h:\visual studio 2005\projects\random data\random data\main.cpp(58) : error C3861: 'GetTickCount': identifier not found
Here's my code:
Code
#include <iomanip>
#include <iostream>
using namespace std;
int MostFrequent(int *data) { ... }
int LeastFrequent(int *data) { ... }
int Mean(int *data) { ... }
void main()
{
int mostFrequent, leastFrequent; // themost and least frequent number
double mean; // the mean of all of the random numbers
int randInt[1000]; // array which gets filled up with random integers from 0-1000
int data[1000] = {0}; // array with 1000 elements of 0
//set the random numbers to be random each time
//-- ERROR --> srand(GetTickCount());
//randomize an int from 0-999 storing it in an array, and adding
//a count to another array to keep track of how many there are.
for ( int x = 0; x < 1000; x++ )
{
randInt[x] = ( ( ( rand() * 1000 ) / RAND_MAX ));
data[randInt[x]]++;
}
//call functions and return most and least frequetn integers, and the mean.
mostFrequent = MostFrequent(data);
leastFrequent = LeastFrequent(data);
mean = Mean(randInt);
//display the information to the user
cout << "Most Frequent:" << setw(6) << mostFrequent << " appeared " << data[mostFrequent] << " times." << endl;
cout << "Least Frequent: " << setw(4) << leastFrequent << " appeared " << data[leastFrequent] << " times." << endl;
cout << "The mean is: " << mean << endl << endl;
//allow the user to view the results before quitting
system("pause");
}//end main
#include <iostream>
using namespace std;
int MostFrequent(int *data) { ... }
int LeastFrequent(int *data) { ... }
int Mean(int *data) { ... }
void main()
{
int mostFrequent, leastFrequent; // themost and least frequent number
double mean; // the mean of all of the random numbers
int randInt[1000]; // array which gets filled up with random integers from 0-1000
int data[1000] = {0}; // array with 1000 elements of 0
//set the random numbers to be random each time
//-- ERROR --> srand(GetTickCount());
//randomize an int from 0-999 storing it in an array, and adding
//a count to another array to keep track of how many there are.
for ( int x = 0; x < 1000; x++ )
{
randInt[x] = ( ( ( rand() * 1000 ) / RAND_MAX ));
data[randInt[x]]++;
}
//call functions and return most and least frequetn integers, and the mean.
mostFrequent = MostFrequent(data);
leastFrequent = LeastFrequent(data);
mean = Mean(randInt);
//display the information to the user
cout << "Most Frequent:" << setw(6) << mostFrequent << " appeared " << data[mostFrequent] << " times." << endl;
cout << "Least Frequent: " << setw(4) << leastFrequent << " appeared " << data[leastFrequent] << " times." << endl;
cout << "The mean is: " << mean << endl << endl;
//allow the user to view the results before quitting
system("pause");
}//end main
Any help would be nice, unless you know of an alternate way of getting actual random data every time the program is run. If you need any more information please ask.
None.