I am in grade 11 Computer Sciences and i am having trouble with my programs and my instructor doesn't really know how to fix this. Maybe someone could take a look.
The cout at the end is outputting the wrong numbers and i don't understand why.
if(numbers[i]>highest)
{
cout<<highest<<" - "<<i<<endl;
highest=numbers[i];
href=i; // href is the value at which the highest number is at.
}
You're outputting the same number twice. You want to output randomdata[href]. Also, get rid of void main(), as it's non standard, #include <cstdlib> for srand() and rand(), and be careful never to call srand() more than once per program execution.
int main() is standard. It should return 0 upon successful execution.
srand() seeds the random number generator. For each different seed, you get a different random-like sequence. So you just call it once, and then call rand() as many times as you want to get random-like numbers.
main has to return an int. It indicates whether the program terminated correctly (0) or not (some other value). void main() is illegal. Some compilers implement it as an extension, but it's still non standard C++.