I'm doing someone else's homework. I saw someone else post this exercise and thought, "I can do that." Well, apparently... I can't
The problem is to create an array and populate it with random numbers. Then, sort the array. I'm doing something wrong trying to generate the random data
//randSort.cpp
//Generate 100 random numbers to populate an array
//Sort the numbers
#include <iostream>
#include <stdlib.h>
#include <time.h>
using std::cout;
using std::endl;
int sort(int array[]);
int main(void)
{
int large[1000];
for(int i = 0; i < 1000; i++)
{
//srand(time(NULL));
large[i] = rand % 250;
}
for(int i = 0; i < 1000; i++)
{
cout << large[i];
if(large[i] % 10 == 0)
cout << endl;
}
return 0;
}
The errors I receive are associated with line 19:
1 2 3
Error 1 error C2296: '%' : illegal, left operand has type 'int (__cdecl *)(void)' c:\users\killingthemonkey\...randsort.cpp 19 1 randSort
2 IntelliSense: expression must have integral or unscoped enum type c:\Users\killingthemonkey\...randSort.cpp 19 20 randSort
I've looked at the manual for random and I've looked at other people's code. I can't understand where my train is going off the rails.